View Single Post
  #5 (permalink)  
Old 08-07-2006, 11:03 PM
TkTech TkTech is offline
Speaks fluent binary
 
Join Date: Jun 2006
Posts: 1,047
Last Blog:
Having trouble with yo...
Credits: 0
Rep Power: 16
TkTech is on a distinguished road
Send a message via MSN to TkTech
Default

Frantic, if youve never heard of it, then just stick to standard c++

Code:
#include <fstream>

void main( void )
{
  ifstream fin("myfile.ini" , ios::in );
  ofstream fout;
  if( fin.fail() ) //File error
 {
    //So create the file
     fout.open("myfile.ini" , ios::out | ios::trunc );
     //File it with the default text/binary
     fout << "Whateveryouwantasdefault";
    //Close and clear the file write buffer
     fout.close();
     fout.clear();
    //And reopen the file
     fin.open("myfile.ini" , ios::in );
  }
   //Now do your normal operations as if nothing ever happend
   fin.read((char *)&bla , sizeof(blastruct));
   fin.close();
}
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Reply With Quote

Sponsored Links