Fread problem.
#1

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 
0i<MAX_PLAYERSi++)
    {
        
format(contact128,"LV-RP/%s/Contacts/%s.ini"GetPlayerNameEx(playerid), i);
        new 
File:file fopen(contactio_read);
        while(
fread(contactstr))//error 035: argument type mismatch (argument 1)
        
{
             if(
strcmp(filetemptrue) == 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
Reply
#2

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.
Reply
#3

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)