What is the sign of the end of the file, for example, text?
Is there any end-of-file character, or knowing its size in advance, count the number of unread bytes?

    1 answer 1

    Once in ancient times in DOS times, the symbol Ctrl-Z (0x1A) theoretically served as such a sign for text files. Actually - even then it did not work, and if it worked, it interfered.

    If during the next reading it failed - you can check the status of the stream and find out if the end of the file ( feof() in C, .eof() in C ++) has not been reached.

    I emphasize: you can check the achievement of the end of the file after unsuccessful reading, and not before . So check the end of the file before reading - run for an error ...

    • Thanks for the reply - Sokuroff