Hi,
I had a trouble with reading the first line of a file, or to be more accurate, I found that the first character of the file is not something that appears on the actual file, for example:
my file looks like this:
PHP Code:
"pokemon" "pokemon.mp3"
"marko" "marko.mp3"
but when I'm trying to print the first character of the file (witch shoud be "p"), it's gives me something else:
This causing me troubles when I'm trying to compare the SongName with a client input..
so here's my code:
PHP Code:
#include <amxmodx>
#define MAX_SONG_NAME 32
#define MAX_PATH_SIZE 64
#define CfgFile "addons/amxmodx/configs/cfg.txt"
new SongName[MAX_SONG_NAME];
new SongPath[MAX_PATH_SIZE];
new SongsLoaded;
public LoadSongs()
{
if (file_exists(CfgFile))
{
new text[64];
new file = fopen(CfgFile, "r");
while (!feof(file))
{
fgets(file, text, charsmax(text));
replace(text, charsmax(text), "^n", "");
if (text[0] == ';' || !text[0]) continue;
console_print(0, "[ test ] %c", text[0]);
console_print(0, "[ test2 ] %s", text[0]);
parse(text, SongName, MAX_SONG_NAME, SongPath, MAX_PATH_SIZE);
SongsLoaded++;
}
fclose(file)
}
else
log_message("(Error) Failed to load file nostalgia.txt.");
}
Can someone explain me what am I doing wrong?
Thanks in advance.