thank you all for the answers
I was getting the values from the file in a wrong way, i'm used to the C way
fscanf( file, "%d", &var )
About the iostream... i really prefer the stdio lib, it looks more "clean" and simple to me. If I can't solve this little problems or if i find out it's really more safe to use stdio or the iostream i'll use one of them
Another thing,
when i write the values to "config.conf" it will remain empty. Maybe it's something i miss:
void settings_default( void )
{
width = 800;
height = 600;
depth = 32;
fullscreen = 0;
strcpy( title, "Prototype #03" );
}
void settings_apply( void )
{
dbSetDisplayMode ( width, height, depth );
dbSetWindowSize( width, height );
dbSetWindowLayout( 1, 1, 1 );
dbSetWindowTitle( title );
fullscreen == 0 ? dbSetWindowOn() : dbSetWindowOff();
}
void settings_load( void )
{
if( dbFileExist( "config.conf" ) == 1 )
{
dbOpenToRead( 1, "config.conf" );
width = dbReadFile( 1 );
height = dbReadFile( 1 );
depth = dbReadFile( 1 );
fullscreen = dbReadFile( 1 );
dbReadString( 1, title );
dbCloseFile( 1 );
settings_apply( );
}
else
{
settings_default();
dbMakeFile( "config.conf" );
dbOpenToWrite( 1, "config.conf" );
dbWriteFile( 1, width );
dbWriteFile( 1, height );
dbWriteFile( 1, depth );
dbWriteFile( 1, fullscreen );
dbWriteString( 1, title );
dbCloseFile( 1 );
settings_apply( );
}
}
the first function to be called is void settings_load( void )
P.S.
Even with this simple little test:
int lol = 1;
dbMakeFile( "config.conf" );
dbOpenToWrite( 1, "config.conf" );
dbWriteFile( 1, lol );
dbCloseFile( 1 );
still gives an empty file