when I write a number to binary file, it won’t display. but in case of a character, it does. why? how would you check to see if the file containing character is binary?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It has all to do with how you interpret what is in the file. Everything in a file is binary, a character an integer etc.
When you do TYPE in the console on a file (or CAT or whatever OS u have) the contents of the file are interpreted as text by default because the programmer of TYPE decided to write it like that.
When you write a program to read out data from a file it is up to you to decide how to interpret the data what you read.
That is why you can only guess file contents and that is why often the extension of a file is used to give a hint on how the contents should be interpreted.