#1

I am using Y_INI, How can I make it create a file if it doesn't exist? Or does y_ini not do that? Or, do you suggest a different include?
Reply
#2

If a file does not exist (but the directory does) it will automatically create the file using INI_Open.

For example:

pawn Код:
new
        INI: newFile = INI_Open ( "testing_yini.txt" ),
        testStr [ 64 ];

    for( new i; i < 20; i ++ )
    {
        format( testStr, sizeof ( testStr ), "Testing_%d", i );
        INI_WriteInt ( newFile,     testStr,    i );
    }
   
    INI_Close ( newFile );
This would create a new file "testing_yini.txt" inside of our scriptfiles folder with the file contents being...

Testing_0 = 0
Testing_1 = 1
Testing_2 = 2
Testing_3 = 3

And on and on until our iteration (loop) is finished.
Reply
#3

Is there any way to just simply check if a file exists?
Reply
#4

pawn Код:
if(!fexist(/*the file*/))
{
//code
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)