Reading data from file
#1

Quote:

format(var, 128, "Passwort=%s\n",Stat[playerid][password]);fwrite(hFile, var);
format(var, 128, "Level=%d\n",Stat[playerid][level]);fwrite(hFile, var);

Thats how I write some stuff in a userfile...

Now I want to read all this stuff from this file..

Quote:

new File: UserFile = fopen(string, io_read);
if ( UserFile )
{

new keytmp[256], valtmp[2][256];
while(fread( UserFile , keytmp , sizeof( keytmp )))
{

split(keytmp, valtmp, '=');
if(strcmp(valtmp[0], "Passwort", true) == 0)
{
strmid(Stat[playerid][password], valtmp[1], 0, strlen(valtmp[1]), 255);
}


}
if(!(strcmp(Stat[playerid][password], tmppass, true) == 0))
{
SendUserMessage(playerid, COLOR_GREY, "Wrong password !", "Falsches Passwort!");
Kick(playerid);
return 1;
}

And at this point, I always get the message Wrong password...
What did I do wrong? (I typed in the correct password :d )
Reply


Messages In This Thread
Reading data from file - by RDragon - 27.06.2009, 08:10
Re: Reading data from file - by Ignas1337 - 27.06.2009, 08:40
Re: Reading data from file - by RDragon - 27.06.2009, 08:43
Re: Reading data from file - by RDragon - 27.06.2009, 08:51
Re: Reading data from file - by RDragon - 27.06.2009, 09:04

Forum Jump:


Users browsing this thread: 1 Guest(s)