Archive: DetailPrint & FileRead


DetailPrint & FileRead
I have text file - history.txt -


qwert
asdfg
zxcvb
poiuy
lkjhg
mnbvc


Inside section read all its strings:

SetDetailsPrint both
ClearErrors
FileOpen $0 "f:\test\history.txt" r
IfErrors readok
read:
FileRead $0 $1
ifErrors readok
DetailPrint $1
MessageBox MB_OK|MB_ICONSTOP "$1"
goto read
FileClose $0
readok:

MessageBox show normal message. But in listbox of instfiles-page i see 2 symbols after every line of history.txt except last line (see attached file).

How can I fix it (remove these symbols)?
Thanks in advance.

Those are probably the $\r$\n characters. You have to use a function that trims those characters. You can find it on Include\StrFunc.nsh, or on Archive.


have a look at the TrimNewlines function


You can find the TrimNewLines function in the docs:
http://nsis.sourceforge.net/Docs/AppendixC.html#C.2

-Stu


Thanks a lot!