Left 4 Dead 2

Left 4 Dead 2

View Stats:
How can i prevent NUL in created text file?
when i use StringToFile() it will create NUL(can use text editor such as notepad++ to see it) at the bottom of text file everytime. regardless of i tried to make it into utf-8 instead ansi but still that NUL still appeared
this code is what i tested
local comment = ""; comment += "################################ ₲ ################################\n"; comment += "################################\n"; StringToFile("testtext/text.txt", comment);
< >
Showing 1-4 of 4 comments
Evil Apr 15 @ 8:43am 
I don't have a solution for this but I had a ton of these script functions for right 2 live and all of them did the same thing. I combed through the initial code when I noticed that but could never find anything that caused it. No extra characters, no spaces that shouldn't be there, yet the NUL thing is still embedded. It doesn't have any negative affects so it's nothing to worry about in the end.
Everice Apr 15 @ 8:53am 
actually it does cause a small problem if you're working with data table things. my mods usually have a lot of works with config files. and that NUL thing becomes a minor problem because the mod did read the NUL and somehow put inside table. if you try to use print or save it into the file it will show as unexpected nul as index inside the table. lol
for example i took it from my mod file txt
index1 = false
index2 = false
unexpected nul = false
i had to make a filter every time to prevent it get into the table or appear in txt file on user end
You cant, its a bug which comes from the c++ or vscript internal.
The documentation tells you cant prevent it from happening.
Everice Apr 16 @ 2:34am 
alright, guess i don't have choice then. thank you
< >
Showing 1-4 of 4 comments
Per page: 1530 50