Fread problem. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Fread problem. (
/showthread.php?tid=410455)
Fread problem. -
Youice - 25.01.2013
hello, there,
Can any one figure why I have these problems?
PHP код:
stock CheckContacts(playerid)
{
new contact[128];
new str[128];
new temp = strlen(str) >= 10;
for(new i = 0; i<MAX_PLAYERS; i++)
{
format(contact, 128,"LV-RP/%s/Contacts/%s.ini", GetPlayerNameEx(playerid), i);
new File:file = fopen(contact, io_read);
while(fread(contact, str))//error 035: argument type mismatch (argument 1)
{
if(strcmp(file, temp, true) == 0)//error 035: argument type mismatch (argument 2)
{
return 1;
}
else {
return 0;
}
}
}
return 1;
}
Errors/warnings
Код:
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
warning 204: symbol is assigned a value that is never used: "file"
warning 204: symbol is assigned a value that is never used: "temp"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Note: I tagged the errors in the code
Re: Fread problem. -
IPrototypeI - 25.01.2013
I hope you know what argument type mismatch (argument 1) means .
you used fread wrong where is the file directory
while(fread(contact, str)) <= wrong
while(fread(file, str)) <= right
the same there
if(strcmp(file, temp, true) == 0)
you can`t use file there use str you get the which you read out of the file in this string
and rethink more about your code i don't understand what do you want to check.
Re: Fread problem. -
Roach_ - 25.01.2013
Try this:
pawn Код:
stock CheckContacts(playerid)
{
new contact[128];
new str[128];
new temp = strlen(str) >= 10;
for(new i = 0; i<MAX_PLAYERS; i++)
{
format(contact, 128,"LV-RP/%s/Contacts/%s.ini", GetPlayerNameEx(playerid), i);
new File:file = fopen(contact, io_read);
while(fread(file, str))
{
if(strcmp(file, str, true, temp)) return 0;
}
}
return 1;
}