File function newline (\n) problem
#1

Well i've never realy needed to use the native file functions untill now, i need to make some logs. However whenever i use a newline charachter instead of printing on a new line its printing to the same line. Where the newline is meant to be there is a rectangle symbol (don't know the name sorry). I cant post the symbol. (it prints a newline on the forum). I know its probably a silly problem but if someone has the solution i'd appreciate it alot.
Heres some example code,
pawn Код:
public OnPlayerText(playerid, text[])
{
    new
        File:tfile = fopen("chatlog.txt", io_append);
    format(text, 128, "%s\n", text);
    fwrite(tfile, text);
    fclose(tfile);
    return 1;
}
Thanks in advance.
Reply
#2

try \r\n instead of \n only
Reply
#3

Thats not the problem all /r does is make the next text start at the beggining of a line. If i did that i would get 2 of them rectangle symbols. Thanks though.

This is the file after 3 words, http://solidfiles.com/d/4a11/ (wont display right here)
Reply
#4

io_append has to be io_write.
Reply
#5

Quote:
Originally Posted by Marcel
Посмотреть сообщение
io_append has to be io_write.
This doesnt mean nothing. io_write will create a new file everytime, io_append will write on each line.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)