|
On 19/02/2014 14.11, René Rebe wrote:
A loop over the lines of any file should reproduce the file, given a reasonable modern, C library, especially when the file is opened in binary mode.
I may be a bit repetitive here, but a binary file by definition has no lines and should not be read with text functions such as gets() that are only designed for text files.
As has been noted, text functions (regardless of what their behaviour on observed systems may be) only guarantee that printable characters, leading spaces and the few control characters listed by the standard are preserved: the printable information.
Of course, an extension library could offer an iterator to read a binary file as a sequence of byte blocks separated by one or more given delimiters, but that is a completely different matter.
-- Enrico