Skip to content
⌘ NSIS Forum Archive

FileRead bug (I hope)

6 posts

JasonFriday13#

FileRead bug (I hope)

What I am doing is looping a FileRead command to read one line at a time from a text file. But I am finding extra characters at the end of the string. I have attached a test script which replicates the problem. I am using nsis 2.42.
JasonFriday13#
And a screenshot when run on my machine (Win XP SP2)
Yathosho#
i'm not on windows now, but two characters at the end of the line - that sounds a lot like "$\r$\n". i remember there is a function on the wiki to get rid of those.
JasonFriday13#
Thats right. Its even worse because in my proper script, the strings are filenames with absolute paths. I am passing these to exewait with makensis (to compile them). Makensis always stops with an error (example):

Can't open script "C:\test.nsi
"

Can nsis be fixed or do I have to chop off those characters manually?
Animaether#
Well there's nothing there to fix - it's reading the entire line, which includes control characters, from the file just like you're instructing it to 🙂

Anyway - yes, you'd have to strip them off yourself;

( same functionality is in StrFunc.nsh that comes with NSIS )