lsdvd won't work on DF 1.8
Dmitri Nikulin
dnikulin at gmail.com
Sat Feb 17 20:41:19 PST 2007
On 2/18/07, Kimura Fuyuki <fuyuki at hadaly.org> wrote:
OK, I give up...
Could someone tell me why the following simple program fails to print a dvd
title? It seems to read from offset 32768. (block boundary?)
#include <stdio.h>
int main(void)
{
FILE *fp;
char buf[33];
buf[32] = '\0';
fp = fopen("/dev/acd0c", "r");
fseek(fp, 32808, SEEK_SET);
fread(buf, 1, 32, fp);
puts(buf);
return 0;
}
You should terminate after the fread's number of bytes, not
arbitrarily at the end of the buffer. If the erase-backwards or
carriage-return characters appear, they will damage the preceding
string, and that's no good. If the DVD titles are null terminated
within the 32 bytes anyway, then you don't even need to pre-terminate.
Either way, what you have now doesn't make much sense.
On that note, it doesn't read from 32768. It reads from 32808, since
that's where it's seeking to.
---
Dmitri Nikulin
Centre for Synchrotron Science
Monash University
Victoria 3800, Australia
More information about the Users
mailing list