argument type mismatch - fopen
#1

Hello. I have the following code:

Код:
CMD:create(playerid,params[])
{
	if(!sscanf(params, "s[12]s[12]", params[0],params[1]))
	{
		new File:INI = fopen(params[0],io_readwrite);
		if(!fexist(INI))
		{
			if(INI)
			{
				fwrite(INI, params[1]);
			}

		}

	}
	else
	{
		SendClientMessage(playerid, -1, "use /create [name] [content]");
	}
	
	return 1;
}
error 035: argument type mismatch (argument 1)
line: marked in red
Reply
#2

pawn Код:
CMD:create(playerid,params[])
{
    new name[24], content[120];
    if(sscanf(params, "s[24]s[120]", name, content)) SendClientMessage(playerid, -1, "use /create [name] [content]");
    else
    {
        if(!fexist(name))
        {
            new File:INI = fopen(name, io_readwrite);
            if(!INI) SendClientMessage(playerid, -1, "[ERROR]: File can't be created on this location!");
            else
            {
                fwrite(INI, content);
                //fwrite(INI, "\r\n");
                fclose(INI);
                SendClientMessage(playerid, -1, "File created.");
            }
        }
        else SendClientMessage(playerid, -1, "[ERROR]: File already exists!");
    }
    return 1;
}
Reply
#3

Thank you. I'm learning the file functions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)