I need to use system calls windows.hto read a file that I get from the command line. I can read the entire file into the buffer with ReadFile()and then cut the buffer on the first \0, but how can I read only one line? I also need to read the last line of the file, is it possible without reading the entire file into the buffer, because maybe the file is 4 GB or more in size, so I won’t be able to read it. So who knows how to read lines?
windows.h
ReadFile()
\0
If you have an idea of long lines, then you are in business, create a buffer that is slightly larger than the maximum.
ReadFile reads a few bytes and cuts a buffer at the first end of the line (\ n)
LZSeek , , .
" \0", ReadFile . . , lpNumberOfBytesRead. nNumberOfBytesToRead, , .
, . '\ r' '\n', . , . , , , , . , ReadFile(), . , , .
ReadFile , . fgets? .
ReadFile
fgets