.dat file knowledge

Pages: 123
Can anyone help me understand how is a .dat file constructed and how to use it like we use .txt files...
So, how to write delete (use) .dat file
closed account (Dy7SLyTq)
just treat it like a normal text file. file io doesnt matter with extensions, unless its like a binary file or an image/video/sound file.
Binary file = image/video/sound file, DTS (In most cases)

A dat file only contains data the program uses. You decide how to write/read it.



File extensions literally mean NOTHING.
Last edited on
closed account (Dy7SLyTq)
actually fred, yes they do matter. and no images/video/sounds are not binary files. dlls, .a's, .exes, .coms are all binary files
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 ;) )

However, I'm not educated enough to know answer to this question, and I'm also curious about it.
Last edited on
closed account (Dy7SLyTq)
actually no im completely right there because he did not ask the proper protocols when dealing with .dat. he said
.dat file constructed and how to use it like we use .txt files
I'm not saying you're wrong. I'm just saying that I guess he maybe tried it, and therefore when he asked
So, how to write delete (use) .dat file

he didn't mean literally "what tool to use", but rather "what should I start with? What's in there?"
closed account (Dy7SLyTq)
he didnt say that. he said how do i treat .dat files. and fred and i have both told him to treat them like text files. and he would need a tool(api or third party software to delete the file)
There is no standard for .dat files. It's up to the program that created them.

They can be text or binary.

DTSCode wrote:
actually fred, yes they do matter. and no images/video/sounds are not binary files. dlls, .a's, .exes, .coms are all binary files
What are they then?

They are binary files.
Last edited on
he didnt say that. he said how do i treat .dat files.


Well, I may have misunderstood him, and I'm also insisting on receiving an answer, because as I said, I'm curious.

Thank you, Lumpkin.
closed account (Dy7SLyTq)
no they arent fred. they are essentially a language and photo viewers are interpreters. if i write 101010100 to a file that doesnt make it a binary file. and matthew what ur asking is beyond the scope of this post. you need to look at file io and fstream. hes asking about a particular file type
What the beans are you talking about? If you wrote 1s and 0s into a file through a text editor I'd just be ASCII.

DTS wrote:
they are essentially a language and photo viewers are interpreters.
wut

Have you ever written a BMP loader from scratch? I've messed around with it and I'm telling you BMP files are binary, along with Mp4s, and I know damn well MD2 files are binary, as I'm writing a custom 3D model format based on it.

Look, http://en.wikipedia.org/wiki/BMP_file_format

Try writing a loader and displaying it with OpenGL(Mainly because it's more simple to use than making it to an SFML texture or SDL_Surface/texture)

An image file is just a series of bytes.
Last edited on
and matthew what ur asking is beyond the scope of this post.

I was afraid it was the case. Well, thanks anyway, and good luck you guys in thread
@ Matthew
I wrote:
There is no standard for .dat files. It's up to the program that created them.

They can be text or binary.
closed account (Dy7SLyTq)
@lumpkin: i never said a text editor. and i have messed with jpeg bmp stuff like that too. its not written in a binary format. and yes its all bytes. a byte is a unit of storage, not a writing format. each command corresponds to a pixel to generate color
@DTSCode
There are two general divisions of files... Those readable by humans ("text" files) and those that are not ("binary" files). So most video/sound/whatever files are actually binary files.

I think you are confused by the fairly common usage of the word "binary" to mean "machine code executable" in the *nix world.
Quick lesson on file types, even if it is a binary file it doesn't mean anything. I have hid files by changing their types like from video to bin so people couldn't open them. All files are written in binumericals <-should be real word), an example of this is the HDD and CPU. The OS (lets use windows) executes notepad.exe and it opens hello.txt. the CPU reads the disk and finds sector 011010000110010101101100011011000110111100101110011101000111100001110100 Once found, the program reads the text document by reading the binary (the file says: hello cplusplus) 011010000110010101101100011011000110111100100000011000110111000001101100011101010111001101110000011011000111010101110011

Anyways what I'm trying to say is just because it isn't executable binary doesn't mean it's not binary.
Last edited on
DTS, no image file has a command in it.
In the most general sense, all files are binary files. They are all just collections of ones and zeros. Whether a file is considered text or not depends on some level of abstraction.

Files that contain only bit patterns that comprise a coded character set recognized by the system on which the file resides are deemed text files. They are usually processed by programs that expect them to contain only those bit patterns that comprise the character set. However, a file that appears to be a text file might actually not be, and processing it as a text file might result in unexpected behavior.

A file that is a recognized as a text file by programs running on one system may not be recognized as such by programs running on another system. A common example would be a text file encoded in EBCDIC residing on a system where the default character set encoding is ASCII. Unless a program on the ASCII system knows that the file was encoded in EBCDIC and processes it as such, it won't recognize the file as being a text file.
closed account (Dy7SLyTq)
alright im probably wrong because thats what im probably thinking of, however @lumpkin yes it does. what do you think the contents mean. every file in the world has commands even a text file, which would be the ascii values it tells the text editor to print
Pages: 123