Read from text file line number: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.) |
m (Adding new author and category links.) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|Afrow UK}} | |||
== Description == | == Description == | ||
This is a simple script that outputs whatever text is on the inputted line number. | This is a simple script that outputs whatever text is on the inputted line number. | ||
Line 42: | Line 40: | ||
-Stu (Afrow UK) | -Stu (Afrow UK) | ||
[[Category:Text Files Manipulation Functions]] |
Latest revision as of 13:36, 24 June 2005
Author: Afrow UK (talk, contrib) |
Description
This is a simple script that outputs whatever text is on the inputted line number.
Usage
Push 23 ;line number to read from Push "$INSTDIR\file.txt" ;text file to read Call ReadFileLine Pop $0 ;output string (read from file.txt)
The Script
Function ReadFileLine Exch $0 ;file Exch Exch $1 ;line number Push $2 Push $3 FileOpen $2 $0 r StrCpy $3 0 Loop: IntOp $3 $3 + 1 ClearErrors FileRead $2 $0 IfErrors +2 StrCmp $3 $1 0 loop FileClose $2 Pop $3 Pop $2 Pop $1 Exch $0 FunctionEnd
-Stu (Afrow UK)