This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: lseek() fails to seek on /dev/fd0 ('\\.\A:')


Hi!
Monday, 26 February, 2001 Jesper Eskilson jojo@virtutech.se wrote:
JE> /* lseek_bug.c */
JE> #include <stdio.h>
JE> #include <fcntl.h>
JE> #include <errno.h>
JE> int main(int argc, char *argv[]) 
JE> {
JE> /* Mount /dev/fd0 as: mount -b '\\.\A:' /dev/fd0 */
JE> char *filename = "/dev/fd0";
JE> int fd, i;
JE> fd = open(filename, O_RDONLY);
JE> if (fd != -1) {
JE> for (i = 0; i < 4; i++) {
JE> printf("\nlseek():ing %d bytes from start of %s.\n", i, filename);
JE> lseek(fd, SEEK_SET, i);
JE> perror("lseek()");
JE> }
JE> }
JE> return 0;
JE> }
the correct prototype of lseek is
off_t lseek(int fildes, off_t offset, int whence);
your program should read like this:
lseek(fd, i, SEEK_SET);
Egor. mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

AltStyle によって変換されたページ (->オリジナル) /