Rainer Stratmann:
> Alternatively you can make a class or an object with the
> text variable in it.
But if you need to work with only one file, you can get rid
of a global variable in the main module by just extracting
the relevant functions and the file handle into a separate
unit:
-
On 5/15/11 8:28 PM, John Lee wrote:
I'd like to put the assign and reset of a text file into a function,
and then use the function to return a line from the file, without
needing to close the file then re assign and reset every time (for
performance reasons) - see below for my attempt.
This
Am Monday 16 May 2011 12:28:19 schrieb johnelee1...@googlemail.com:
> thanks all - btw it wasn't the real code just an example I made up , the
> while loop wasn't needed- mistake!
>
> But the q still remains - having three functions would still give the
> problem I have now- that when doing a file_
On Mon, 16 May 2011 10:28:19 +, johnelee1...@googlemail.com
wrote:
> thanks all - btw it wasn't the real code just an example I
made up , the while loop wasn't needed- mistake!
>
>But the q still
remains - having three functions would still give the problem I have
now- that when doing a f
thanks all - btw it wasn't the real code just an example I made up , the
while loop wasn't needed- mistake!
But the q still remains - having three functions would still give the
problem I have now- that when doing a file_read (my function flag=1) would
say 'file not open' because the handle
In my eyes it is (very) unlogic.
Why don't you make 3 functions?
Something like this...
var filename : string; // global var for storing the filename
function file_reset( name : string ) : boolean;
function file_read( var eof : boolean ) : string;
function file_close : boolean;
Whith your examp
well why not make it a global variable in that unit's implementation?
implementation
var
f:text
.
then have a separate function to close the file.
On 16 May 2011, at 01:28, John Lee wrote:
> I'd like to put the assign and reset of a text file into a function, and then
> use the
At 05:28 PM 5/15/2011, John Lee wrote:
I'd like to put the assign and reset of a text file into a function,
and then use the function to return a line from the file, without
needing to close the file then re assign and reset every time (for
performance reasons) - see below for my attempt.
Th