Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Mon, 26 Feb 2001 13:21:56 +0300 From: Egor Duda X-Mailer: The Bat! (v1.45) Personal Reply-To: Egor Duda Organization: DEO X-Priority: 3 (Normal) Message-ID: <1973702904.20010226132156@logos-m.ru> To: Jesper Eskilson CC: cygwin AT cygwin DOT com Subject: Re: lseek() fails to seek on /dev/fd0 ('\\.\A:') In-reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! Monday, 26 February, 2001 Jesper Eskilson jojo AT virtutech DOT se wrote: JE> /* lseek_bug.c */ JE> #include JE> #include JE> #include 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 AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19 -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple