12.04.2013, 17:57
Yep.
Function where I'm getting the tag mismatch:
how i'm testing it:
Function where I'm getting the tag mismatch:
pawn Код:
stock INI_GetInt(filehandle, Key[], &dest) {
new pos, line[MAX_FILE_STRING];
while( fread(filehandle, line) ) {
if( (pos = strfind(line, Key, false)) != -1 ) {//-1 would be not found
new idx = pos + strlen(Key) + 1;
if(line[idx] == ' ') {//the value is nothing
idx = pos + strlen(Key) + 2;//if the = sign is further across
if(idx > strlen(line)) return -1; //there was no value found
dest = (idx < sizeof(line)) ? strval(line[idx]) : 0;
return 1;
}
dest = (idx < sizeof(line)) ? strval(line[idx]) : 0;
return 1;
}
}
return 0;
}
pawn Код:
new File:Myfile = fopen("MyFile.ini", io_read), myscore;
INI_GetInt(Myfile, "score", myscore);
fclose(Myfile);