This is the mail archive of the cygwin@sourceware.cygnus.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]

Reading a ^Z


Please help someone!

I am sure this has come up before (probably before I joined).
I am reading a binary file. The file is fopened with O_RDONLY.
When doing the read, I am using,

n = fread((void *) buffer, (size_t) sizeof(char), (size_t)
numrecs*reclen, ifd);

where numrecs and reclen are the number of records in the file each of
length reclen.

If there is a control-Z (^Z) in the file, the fread will read up to the
^Z and the rest of the buffer is filled with NULLS.
Now I know, in the distant past, DOS files were terminated by a ^Z, but
surely there is a workaround to this.
I am using b18 with Sergeys latest cygwin.dll.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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