![]() |
|
DAT file question |
blargmob
Member #8,356
February 2007
![]() |
Howdy, I want to create files in my program and save them as .dat for something. My question is, how do I save a .dat file with game data in it so that I can open it and edit it with notepad (txt)? --- |
gnolam
Member #2,030
March 2002
![]() |
Quote: I'm using that allegro DAT grabber thingy that you can find somewhere on this website to make DAT files. My question is, how do I create a DAT file so that I can open it and edit it with notepad (txt)? You don't. -- |
ImLeftFooted
Member #3,935
October 2003
![]() |
Heh. So many ways to answer this question... No. |
blargmob
Member #8,356
February 2007
![]() |
If you've played Soldat than you know you can edit the BOT files with notepad, how do I do that with my own game? --- |
gnolam
Member #2,030
March 2002
![]() |
Quote: If you've played Soldat than you know you can edit the BOT files with notepad, how do I do that with my own game? By not using DAT files. -- |
blargmob
Member #8,356
February 2007
![]() |
Oh crap..... I made a mistake...... I was thinking about files that I save from my program......crap....hang on....lemme edit.... OK I EDITED REREAD POST --- |
gnolam
Member #2,030
March 2002
![]() |
blargmob
Member #8,356
February 2007
![]() |
I know how to write files and read them and stuff, but how do I take that file and open it up in the windows app NOTEPAD and edit it like it was a .txt doc? --- |
gnolam
Member #2,030
March 2002
![]() |
1. Start notepad. -- |
blargmob
Member #8,356
February 2007
![]() |
That don't work. I tried and when I opened the file all I saw was a bunch of jumble text. --- |
Matthew Dalrymple
Member #7,922
October 2006
![]() |
Quote: That don't work. I tried and when I opened the file all I saw was a bunch of jumble text. Then stop writing jumbled text to it EDIT: Are you just writing variables to it or are you converting to a string first? If you want it to be readable you need to write everything as a string to the file. =-----===-----===-----= |
blargmob
Member #8,356
February 2007
![]() |
How do I write everything as a string? I'm using fstream and stuff to write teh files. I'm writing them as ios::binary. How do I write them as string? --- |
moon_rabbits
Member #8,469
March 2007
![]() |
|
HardTranceFan
Member #7,317
June 2006
![]() |
Quote: How do I write them as string? By not using ios::binary? -- |
Hard Rock
Member #1,547
September 2001
![]() |
Okay hopefully this link should help: http://www.cprogramming.com/tutorial/cfileio.html Basically there are two ways to write files, Binary and Text. Notepad can only open text based files otherwise you get the jumbled mess that you are seeing. So you need to write text based files. What moon_rabbits posted is technically wrong(it might work out okay because it only writes within the range of chars notepad can read, but didn't test it), if you want to write text based files instead of: file = fopen ( "yourfile.bin" , "wb" ); // open your file you do file = fopen ( "yourfile.bin" , "w" ); // omit the b Now it looks like you're using C++ so just google for C++ file i/o but make sure its not binary based, as that's what notepad cant read. Also you'll need to convert all your values and codes into pure text (so numbers should be written as letters) for notepad be able to read them. _________________________________________________ |
blargmob
Member #8,356
February 2007
![]() |
So basically all I gotta do is write teh files as a text file instead of binary? But I want teh file exstenstion to be unique, not .txt, but still able to open it with notpad. --- |
Rampage
Member #3,035
December 2002
![]() |
You can change the file associations with Windows Explorer. I'd give you detailed directions, but I don't have Windows in English. -R |
gnolam
Member #2,030
March 2002
![]() |
... lost cause, people. Lost cause. -- |
Matthew Dalrymple
Member #7,922
October 2006
![]() |
Quote: But I want teh file exstenstion to be unique, not .txt, but still able to open it with notpad. A fundamental thing you need to understand is that computers will do exactly what you tell them to do. So if you want to save the file as a different extension, do so. File extensions are really to help with differing files between which programs should open them. That doesn't mean a program can open it and that others cannot. If you know a file is formatted for a program to open it correctly then so what if it doesn't have the same extension. Changing a *.doc file to *.poo doesn't mean Word can't open it. To open it up in Notepad do as gnolam suggested: gnolam said:
1. Start notepad.
You might need to have all files (*.*) instead of text files (*.txt) selected. =-----===-----===-----= |
|