tmclean
(Fresh Scripter)
2006-01-15 04:30 AM
ReadLine

Using the example right out of the manual to readline in a file. When I run the script, the "0" error code is echoed in the display. How do you suppress that? Here's the sample right out of manual, modified slightly.thx

If Open(10, "C:\testlog.txt") = 0
;$x = ReadLine(10)
;WHILE @ERROR = 0
; ? $x
; $x = ReadLine(10)
; LOOP
Close (10)
ELSE
BEEP
? "Config file not opened, error code: [" + @ERROR + "]"
Endif


ShawnAdministrator
(KiX Supporter)
2006-01-15 04:39 AM
Re: ReadLine

Trap (silence) your Close function return code, like this:

$Null = Close (10)

-Shawn


tmclean
(Fresh Scripter)
2006-01-15 04:45 AM
Re: ReadLine

Thank-you very much. I love this forum!

Sealeopard
(KiX Master)
2006-01-15 02:40 PM
Re: ReadLine

BTW, there are ready-made UDFs in the UDF Forum to read a complete text file into an array for further processing, e.g. ReadFile() - Read a file into an array .