Original Post
How to detect the difference between a binary and a text file? Both are just bytes. And Linux sometimes is wrong, it considers a text file with unicode characters as binary!

Quote:
Original post by JoeyBlow2
I thought it had to do with the CR/LF characters at the end of a line.
In binary mode, they'd read just as they are in the file.
In text mode, on windows, a CR/LF would come back as a new line. While on unix (linux?) it would only need either the CR or LF, so one of the CR/LF characters would be stripped from the input.
There is actually no difference in the file. Its just a mode on how the ANSI C functions operate on the file to handle those CR/LF characters.
Something to that effect.
Quote:As TDragon stated, you could rephrase the question this way: "How do I detect the difference between a binary and a text file?" However, the following might be better: "In my program, how can I detect if a given file is text or binary?"
Original post by Lode
How to rephrase the question so that it's the same question but without "how to" at the start? :D
Quote:The problem is that your questions don't state the object that is doing the verb. In the quoted case, the verb is 'rephrase' and the object that will rephrase is you. An appropriate way to rephrase it would be to instead say "How can I rephrase the question.." or "How could I.." or "How would I.."
Original post by Lode
How to rephrase the question so that it's the same question but without "how to" at the start? :D
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more