U++ Forum - RDF feed
https://www.ultimatepp.org/forums/
Getting the file type. (binary vs text files)
https://www.ultimatepp.org/forums/index.php?t=rview&goto=14196&th=3189#msg_14196
captainc2008-02-19T15:17:50-00:00Re: Getting the file type. (binary vs text files)
https://www.ultimatepp.org/forums/index.php?t=rview&goto=14197&th=3189#msg_14197
captainc wrote on Tue, 19 February 2008 17:17
I would like to test for file type. Mainly I want to check whether a file is binary or text. What is the best way to do this?
Actually, the difference between a text file and a binary file is not really present in it's hardware or filesystem representation (at least not under the OSs I know), just in the way we write read from it. It is just a formal difference. Still, if you want only ASCII text, you can read the file and check if all the characters are alphanumeric plus punctuation signs.