Writing a new file line
#1

Hey it writes like this
Код:
[19/03/2010]Player: Nick_Lasdaa has registered, IP:10.0.1.129[19/03/2010]Reached Rank: Private First Class
But i want it to write like this

Код:
[19/03/2010]Player: Nick_Lasdaa has registered, IP:10.0.1.129

[19/03/2010]Reached Rank: Private First Class
I have this
Код:
	format(entry, sizeof(entry), "\n[%02d/%02d/%d]%s\n",Day, Month, Year,string);
Those " \n " should write a new line but instead it writes somekind of symbol and doesnt write in a new line
Reply
#2

Try \r\n, if it still doesn't work then I suggest using another Editor then the Windows Notepad, such as Notepad++.
Reply
#3

format(entry, sizeof(entry), "[%02d/%02d/%d]%s\r\n\r\n",Day, Month, Year,string);

/n = New Line
/r = Return Home

Using 2 of these at the end of your string will cause that space between the lines effect you want:

[19/03/2010]Player: Nick_Lasdaa has registered, IP:10.0.1.129 // /r will bring you back to the beginnning of this line, then /n will go to the next line
// the 2nd \n will go to the next line (Guess the 2nd \r truly isn't needed, but will ensure you stay in the beginning of the line nonetheless)
[19/03/2010]Reached Rank: Private First Class // resulting this line to be used by the next time you write to file or whatever

As for \n returning as some symbol instead of a new line... This part '[%02d/%02d/%d]%s' might be interfering with those \n, not too familar with %02d, %d yes, but not %02d... Look into that, test around a bit
Reply
#4

Thanks, exora. It works now!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)