44696Re: [libertybasic] Re: EOF Indicator/GOSUB
- Mar 1, 2012eof(#f) returns 0 (null chr) if the file has NOT been exhausted.
Your "not(eof(#file))" will have the opposite effect.
Read the Help File, under "EOF( #h )."
...from the world according to GaRPMorE
From: Stefan Pendl <pendl2megabit@...>
Sent: Thursday, March 1, 2012 4:27 PM
Subject: Re: [libertybasic] Re: EOF Indicator/GOSUB
Am 01.03.2012 18:06, schrieb Carl Gundel:
> Is your EOF test immediately after your OPEN statement as your example suggests? It needs to be inside a loop.I am always using a construct like the one below.
'---code start (watch for line wraps)
open FileName$ for input as #file
' code to parse the file and
' fill an array with the collected information
This is secure and easy to understand.
I wouldn't jump around in the code using GOTO or GOSUB, since I never
had a need to do so.
It is always best to collect the information before you use it and fill
an array with it.
This speeds up your program immensely compared to reading one entry at a
time and processing it immediately.
LB 4.04 Pro ... http://www.libertybasic.com/assist.html
LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
LB Community Wiki .............. http://basic.wikispaces.com/
LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
Books at http://www.lulu.com/ and http://www.amazon.com/
Alyce Watson ... APIs for Liberty BASIC
Carl Gundel .... Beginning Programming with Liberty BASIC
Windows 7 Home Premium 64-bit SP1
AMD Turion X2 RM-70 2GHz, 4GB RAM
[Non-text portions of this message have been removed]
- << Previous post in topic Next post in topic >>