File writing
#1

Ok, i have decided to go through wiki and 're-learn' everything in there and also read the pdf's on compuphase in order to get a better understanding on the pawn language. I have found a problem, after doing about files it seems i cant write a new line for example:
Код:
line 1
line2
It will simply put line 1 and never line 2. I have put \r\n (new line) and yet it does not write a new line, is there anything I'm doing wrong?

pawn Код:
if (strcmp("/file", cmdtext, true, 10) == 0)
    {
       
        new File:file=fopen("test.txt", io_write);

        if(file)
        {
            fwrite(file, "This text has been written to the file\r\n");
            fclose(file);
        }
        return 1;
    }
Reply
#2

Код:
io_write
Removes all text in your test.txt File and writes a new text. You may use,
Код:
io_append
instead of io_write

Quote:

io_write Write in the file, or create the file. Erases all contents.
io_append Appends (adds) to file, write-only. If the file does not exist, it is created

Reply
#3

Quote:
Originally Posted by MouseBreaker
Посмотреть сообщение
Код:
io_write
Removes all text in your test.txt File and writes a new text. You may use,
Код:
io_append
instead of io_write
I already tried this but will try again.
Reply
#4

@thefatshizms: I already tried this but will try again.

It works fine on my computer.
Reply
#5

btw, thefatshizms nothing is wrong with your /file command. You're simply starting a new line but not writing anything afterwards
Reply
#6

Ok, thanks vincent

I changed it to append and it still didn't work, i then re downloaded the sa-mp package and now its working.
Reply
#7

No thanks for me? /Cry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)