Linux problem
#9

Valid file handle means if the file was opened successfully, not if it exists.

You haven't checked for both (even though in the SaveHouses you haven't posted the part that writes).

pawn Код:
LoadHouses()
{
    if(!fexist("apartments.cfg")) return 1;
   
    new
        szFileStr[1024],
        File: iFileHandle = fopen("apartments.cfg", io_read),
        iIndex;
   
    if (iFileHandle) // valid handle
    {
        while(iIndex < sizeof(HouseInfo) && fread(iFileHandle, szFileStr))
        {
            sscanf(...);
            // may some other code..
           
            iIndex++;
        }
        fclose(iFileHandle);
    }
    return 1;
}
pawn Код:
SaveHouses()
{
    new
        szFileStr[1024],
        File: fHandle = fopen("apartments.cfg", io_write);
   
    if (fHandle) // valid handle
    {
        for(new iIndex; iIndex < MAX_HOUSES; iIndex++)
        {
            format(...);
            fwrite(fHandle, szFileStr);
        }
        fclose(fHandle);
    }
    ...
    return 1;
}
Reply


Messages In This Thread
Linux problem - by FaZeRs - 23.03.2014, 13:42
Re: Linux problem - by Konstantinos - 23.03.2014, 13:44
Re: Linux problem - by FaZeRs - 23.03.2014, 13:50
Re: Linux problem - by Konstantinos - 23.03.2014, 14:05
Re: Linux problem - by FaZeRs - 23.03.2014, 17:57
Re: Linux problem - by Arjanz - 23.03.2014, 18:00
Re: Linux problem - by Konstantinos - 23.03.2014, 18:02
Re: Linux problem - by FaZeRs - 23.03.2014, 18:58
Re: Linux problem - by Konstantinos - 23.03.2014, 19:07
Re: Linux problem - by FaZeRs - 23.03.2014, 21:57

Forum Jump:


Users browsing this thread: 5 Guest(s)