DragonFly users List (threaded) for 2007-02
Re: lsdvd won't work on DF 1.8
On 2/18/07, Kimura Fuyuki <email@example.com> 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?)
buf = '\0';
fp = fopen("/dev/acd0c", "r");
fseek(fp, 32808, SEEK_SET);
fread(buf, 1, 32, fp);
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.
Centre for Synchrotron Science
Victoria 3800, Australia