ID:110510
 
Not a bug
BYOND Version:480
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Firefox 3.6.13
Applies to:DM Language
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
The text2file() function appends a newline at the end of the file it is spitting text into, even if the variable being dumped doesn't have a newline at the end. Calling the function multiple times on the same file will cause many newlines to be appended to the end of the file.

Numbered Steps to Reproduce Problem:
1) Use text2file("my_text","my_file.txt")
2) Open my_file.txt to see "my_text" with a newline after it, call the function more than once and notice multiple newlines.

Code Snippet (if applicable) to Reproduce Problem:
mob/verb/Test()
text2file("my_text","my_file.txt")


Expected Results:
Text to be written exactly as it appears in the variable.

Actual Results:
Newlines being appended to the end of the file.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Yes.
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?
Never.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

It has been happening as long as I can remember.

Workarounds:

[Edit]
Append \... to the end of the text you're spitting into the file.
Tom and I just figured this was caused by how BYOND handles outputting text. Appending \... to the end of the string being sent to the file will cause the newline to be excluded.

This has been noted in the reference (a while back heh, we both forgot about it), and my report has been modified.