Thread: Dat files

  1. #1
    Registered User
    Join Date
    Sep 2002

    Dat files

    It might be a silly question but I have to ask it.
    It is about dat files one friend of mine said to me that dat files are normal exe files but the ending was changed.

    When this isn't true how can I creat dat files and how i link them to my game (like normal exe files with spawnl(bla,dsd.exe,bla))

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    There is no specific layout of a dat file, it can be whatever you want. A text file, a bitmap or pure binary data suited for your datatypes. You choose.
    It's the way you handle the data that counts.

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User FearOfTheDark's Avatar
    Join Date
    Jan 2003

    Binary datfile!

    To creat a binary datafile, if that's what you want:

    struct hello
    int a,b,c,d;
    //What ever you want...

    fstream f("c:\\hello.dat",ios:ut|ios::binary);
    for(int a=0;a<100;a++)
    f.write((char *)(lj+a),sizeof(struct hello));

    And to read the same datafile:

    int count=0;
    cout<<"The file does not exist!";
    fstream f("c:\\hello.dat",ios::in|ios::binary);
    { *)(j+count),sizeof(struct hello));
    -We're living in a illusion!
    -Ok, if that's what you think!

  4. #4
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Well your friend was partially right, if i compiled whatever.exe and renamed it to whatever.dat, i believe it would still run.
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dat files with visual C++
    By abhinavbezgam in forum C++ Programming
    Replies: 1
    Last Post: 05-20-2009, 09:55 PM
  2. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  3. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  4. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM
  5. n00b question.... dat file related
    By hobbes67 in forum C Programming
    Replies: 7
    Last Post: 06-24-2005, 11:39 AM