This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Rub0Gameton's profile picture

writeLine() doesn't append an end-of-line character.

Started by Rub0Gameton, 15 September 2012 - 01:36 PM
Rub0Gameton #1
Posted 15 September 2012 - 03:36 PM
First, here's my code…

  print("Choose a name for your computer!")
  write("*")
  computerName = read()
  fs.copy("disk/boogaos.bga","boogaos.bga")
  fs.makeDir("boogaos")
  config = fs.open("boogaos/boogaos.cfg", "w")
  config.writeLine(version)
  config.writeLine(computerName)
  config.close()
  logfile = fs.open("boogaos/boogaos.log", "w")
  logfile.writeLine("[INFO] Log File Created")
  logfile.writeLine("[INFO] Installed BoogaOS Version "..version)
  logfile.writeLine("[INFO] Server configuration file created at boogaos/boogaos.cfg!")
  logfile.close()
The config file displays the version and the computer name in the same line with nothing between them. However, The log file works correctly, putting each line separately. I see no difference between these 2, any help?
Rub0Gameton #2
Posted 15 September 2012 - 04:01 PM
Ok, fixed.
After a bit of time, I found out it was opening with Notepad and not Notepad++. When I opened it with Notepad++ it seemed like they were actually in different lines. Why did the .log display them? Because my file associations already had .log with NP++.

Teaching: Don't use notepad!