The file doesn't tell the editor what to print. BIt pattern 01001010 is not a command to an editor to display the ASCII letter 'J'. The editor interprets the bit patten as ASCII letter 'J' because it is using ASCII as the coded character set and it presumes the file contains ASCII text characters. If it were using an EBCDIC character set, it would display a cent sign, ¢.
Consider this pattern of bits:
01001011 01001100 01001101 01001110
If an editor interprets this using an ASCII character set, it will display the four characters "KLMN". But if it interprets it as EBCDIC, it will display ".<(+". Either way, the file is just a set of ones and zeros. It might not be a text file at all, but only appear that way if displayed with a text editor. That bit pattern could just as well be the four byte binary representation of decimal integer 1,263,291,726.
Oh, I thought it was an actual code haha. When you execute the binary it becomes a command. There is a file on your computer (hidden in the HDD somewhere) called bootmgr which is just a bunch of data (binary) which runs like a command (binary) executed by the machines BIOS. The computer (last time I checked) can't boot without it and is the binary you first create in order to make an OS.
Yes, and if you try to open an exe in notepad, you will get random chars. Data is defined by how you interpret it. I once made a program that made an exe file with text in it. I could open it in notepad and everything. When I tried to run it, it said, "List.exe is not a valid Win32 application."
They are not random, that is just how notepad reads it. I have never used a sexxydecimal viewer before, you can make a binary that can read the plain binary of any file easily. It may not work as well as a hexxy reader but at least it does something.
I guess what the guy meant, was that he would like to know how to deal with .dat files. Like, is there some sort of standard which you should follow when reading/writing this kind of file. For example, if you have csv file or xml file, they all have some common patterns that you use, so even if you don't really know what's it for, you can see what's in there, because you know the pattern. If you open .dat file in text editor, you're gonna have some strange symbols popping up. Your first answer, DTS, was therefore not complete.( no offence of course ;) )
Actually he is right... I already know everything about binary files, but in a C++ exercise gave me a .dat file where name of students and exam grades were written and asked me to make a program to rank the students...
I was wandering how the hell can a write a program that reads sth that when I open in notepad reads some strange characters...
Can anyone create a small program and explain what the hell is this type of file
The exercise should have provided also the format of the .dat file otherwise the exercise expects you to be able to reverse engineer the file format!
See if you have an exercise before this one that wrote the file.
Ye, it did:
Actually it said the .dat file should have this things written but I don't know how to write the file so then I can work with the program...It was written in the paper that the .dat file we were supposed to use was like that... I opened a .dat file and there was nothing normal (no text)...