Question about dini
#10

The following code is to check for files that exist:
pawn Код:
#define MAX_FILES 1000
......
for(new f=0; f < MAX_FILES; f ++)
{
    new fileName[25]; format(fileName, 25, "%d.ini", f);
    if(dini_Exists(fileName))
    {
       //Do something here.
    }
    else
    {
        continue;
        //OR
        break;
        //Continue or break is based on your personal preference.
    }
}
This code is to check if the file doesn't exist:
pawn Код:
#define MAX_FILES 1000
......
for(new f=0; f < MAX_FILES; f ++)
{
    new fileName[25]; format(fileName, 25, "%d.ini", f);
    if(!dini_Exists(fileName))
    {
       //Do something here, then call break; to make sure you don't spit out 5000000 files repeatedly.
       break;
    }
    else
    {
        continue;
    }
}
EDIT: Am I the only one that posted correct code?
Reply


Messages In This Thread
Question about dini - by milanosie - 23.01.2012, 13:26
Re: Question about dini - by ricardo178 - 23.01.2012, 13:49
Re: Question about dini - by milanosie - 23.01.2012, 13:58
Re: Question about dini - by Konstantinos - 23.01.2012, 14:00
Re: Question about dini - by milanosie - 23.01.2012, 14:03
Re: Question about dini - by milanosie - 23.01.2012, 14:11
Re: Question about dini - by Konstantinos - 23.01.2012, 14:13
Re: Question about dini - by milanosie - 23.01.2012, 14:16
Re: Question about dini - by milanosie - 23.01.2012, 15:33
Re: Question about dini - by SchurmanCQC - 23.01.2012, 15:38

Forum Jump:


Users browsing this thread: 2 Guest(s)