Archive: FileRead idea


FileRead idea
would be nice to have something like

FileRead [/MATCHCASE] handle user_var

what do you think?


hmm, i think the answer from the nsis-devs would sound like this:
use the current 'FileRead' to read out the strings, and convert them with the 'StrUpper' and 'StrLower' functions. the functions are stored at the archives.

;D


i dont want to convert them. i want to find "Expression", not "expression" or anything else. so either fileread or strcmp should have that matchcase option.


It's not possible to perform a case-sensitive string comparison directly with NSIS, but using System.dll you can use the Win32 lstrcmp function. LogicLib provides a wrapper around this: you can !include LogicLib.nsh then use code such as

${If} $0 S== "Expression"
; Do something
${EndIf}

Bug in Documentation:

If the end of file is read and no more data is available, the output string will be empty, and the error flag will be set.
You forgot to tell about the null character; when you read it alone (reading just a char.) or several chars (sufficient to occupy all the result string), FileRead sets the error flag. Or try to fix the bug itself.