Jump to content
Sign in to follow this  
anixon

Const

Recommended Posts

How do I make the the value assigned to $line using FileReadLine a 'Const' for the time that the script is running?

$file = FileOpen("c:\temp\test\xyz.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

MsgBox(0, "Line read:", $line)

Wend

FileClose($file)

Share this post


Link to post
Share on other sites

You don't

$s_text = ""
$file = FileOpen("c:\temp\test\xyz.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    $s_text &= $line & @LF
WEnd

FileClose($file)
$s_text = StringTrimRight($s_text,1)
MsgBox(0,"File Read", $s_text)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...