I looked at the code in github and the function has been removed in the YSI 4 version. That's the way it was used in the older version:
PHP код:
bool:INI_GetEntryName(source[], dest[], &i)
{
new
j;
while (source[j] && source[j] <= ' ') j++;
i = j;
while (source[i] > ' ' && source[i] != '=') i++;
if (i == j) return false;
i -= j;
memcpy(dest, source, j, i * 4, MAX_INI_ENTRY_NAME);
dest[i] = '\0';
return true;
}
PHP код:
EntryNameExists(const file_name[], const entry_name[])
{
new File: f = fopen(file_name, io_read);
if (!f) return 0;
new line[MAX_INI_ENTRY_NAME], stringIdent[MAX_INI_ENTRY_NAME], pos, comment;
while (fread(f, line))
{
StripNL(line);
if (!line[0]) continue;
comment = chrfind(';', line);
if (comment != -1) line[comment] = '\0';
if (INI_GetEntryName(line, stringIdent, pos) && !strcmp(entry_name, stringIdent)) return fclose(f), 1;
}
return fclose(f), 0;
}
You have to read every line of the file and check if the entry returned is the one you want. An example:
pawn Код:
if (!EntryNameExists("some_file.ini", "some_entry")) print("\"some_entry\" does not exist in the INI file.");