fopen problem
#2

when you open a file, you should check if the operation was successful before fwriting / freading. This is because there will be an error if you try to perform file operations on a file that was never opened.
pawn Код:
new File:news = fopen(string,io_write); // don't forget the semicolan
if(news)
{
    //rest of file operations here
     fclose(news);
}
the 'io_write' operation will clear a file and write in it as if it were a new file, so you can't just write one selected line to the file, you have to write the entire contents of the file again.

You can however use 'io_append' which will leave the file intact, and anything written will be added to the end of the file.
Reply


Messages In This Thread
fopen problem - by CSMajor - 16.10.2010, 01:13
Re: fopen problem - by Rachael - 16.10.2010, 01:44
Re: fopen problem - by CSMajor - 16.10.2010, 01:49
Re: fopen problem - by Rachael - 16.10.2010, 01:56
Re: fopen problem - by CSMajor - 16.10.2010, 02:19
Re: fopen problem - by Rachael - 16.10.2010, 02:39
Re: fopen problem - by CSMajor - 16.10.2010, 02:44

Forum Jump:


Users browsing this thread: 1 Guest(s)