ULX

Author Topic: Quick question on file.Append  (Read 1948 times)

0 Members and 1 Guest are viewing this topic.

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Quick question on file.Append
« on: March 23, 2015, 02:27:49 PM »
I'm starting to create my own heavy logging system, but there's this one part I could never figure out

I'm starting simple (chat logs)
The logging part is working fine and all, but I can not for the life of me figure out how to put each new addition to the data file on a new line
I tried putting \n into the file.Append string but that wouldn't change what ended up in the code for whatever reason
This is how I'm editing the file right now
file.Append("chatlogs/"..curdate..".txt", newline.."\n")

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Quick question on file.Append
« Reply #1 on: March 23, 2015, 02:30:05 PM »
I'm starting to create my own heavy logging system, but there's this one part I could never figure out

I'm starting simple (chat logs)
The logging part is working fine and all, but I can not for the life of me figure out how to put each new addition to the data file on a new line
I tried putting \n into the file.Append string but that wouldn't change what ended up in the code for whatever reason
This is how I'm editing the file right now
file.Append("chatlogs/"..curdate..".txt", newline.."\n")
How are you viewing the file created by your script? Windows Notepad?
Either try a different text editor, or use \r\n as a new line escape sequence.
bw81@ulysses-forums ~ % whoami
Homepage

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Quick question on file.Append
« Reply #2 on: March 23, 2015, 02:43:26 PM »
How are you viewing the file created by your script? Windows Notepad?

Yep, that would be it
Just checked it in Notepad++ and it shows on different lines there
Now I have even more reason to never use Notepad
Thanks for the quick response, Bytewave