Error...
#1

error 027: invalid character constant

So this is the first time i see this error and i don't know how to fix it:

pawn Код:
public Log(string[], filename[], player)
{
    new h,mi;
    gettime(h,mi);
    new File:hFile;
    new entry[256];
    new year, month, day;
    getdate(year, month, day);
    if(player == 0)
    {
        format(entry, sizeof(entry), "XRPG\Logs\Global\%s",filename); // Here's the error.
        hFile = fopen(entry, io_append);
        format(entry, sizeof(entry), "[%02d/%02d/%02d @ %02d:%02d] %s\r\n",day,month,year,h,mi,string);
        fwrite(hFile, entry);
        fclose(hFile);
    }
    else
    {
        format(entry, sizeof(entry), "XRPG\Logs\Player\%s",filename); // And here's the error.
        hFile = fopen(entry, io_append);
        format(entry, sizeof(entry), "[%02d/%02d/%02d @ %02d:%02d] %s\r\n",day,month,year,h,mi,string);
        fwrite(hFile, entry);
        fclose(hFile);
    }
    return 1;
}
Please help, thank you.
Reply
#2

change the '\' with '/'
Reply
#3

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
change the '\' with '/'
Or add one additional '\'
Reply
#4

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
change the '\' with '/'
I did, and it compiled the same.

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Or add one additional '\'
Where?
Reply
#5

Quote:
Originally Posted by Whizion
Посмотреть сообщение
I did, and it compiled the same.
You didn't.

pawn Код:
stock Log(string[], filename[], player = 0)
{
    new h,mi;
    gettime(h,mi);
    new File:hFile;
    new entry[256];
    new year, month, day;
    getdate(year, month, day);
    if(player == 0)
    {
        format(entry, sizeof(entry), "XRPG/Logs/Global/%s", filename);
        hFile = fopen(entry, io_append);
        format(entry, sizeof(entry), "[%02d/%02d/%02d @ %02d:%02d] %s\r\n",day,month,year,h,mi,string);
        fwrite(hFile, entry);
        fclose(hFile);
    }
    else
    {
        format(entry, sizeof(entry), "XRPG/Logs/Player/%s",filename);
        hFile = fopen(entry, io_append);
        format(entry, sizeof(entry), "[%02d/%02d/%02d @ %02d:%02d] %s\r\n",day,month,year,h,mi,string);
        fwrite(hFile, entry);
        fclose(hFile);
    }
    return 1;
}
Reply
#6

Thanks, it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)