2
In C, if I open a file in binary mode, read it byte-by-byte and then take the file and read it in text mode, will the amount of bytes be different? If so, why?
2
In C, if I open a file in binary mode, read it byte-by-byte and then take the file and read it in text mode, will the amount of bytes be different? If so, why?
5
By no means does the file have the amount of bytes it has, no matter the read mode.
What changes is that reading in text mode there is a treatment for the word wrap indicator that will be interpreted according to the operating system. Nothing else is different. Obviously the translation of the text change indicator can vary from 1 or 2 bytes and it may be that the use adopts as 1 character always, but there is something specific, circumstantial and about characters and not byte.
Browser other questions tagged c filing-cabinet
You are not signed in. Login or sign up in order to post.
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site.
– Maniero