Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-07

file

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Olaf Leidinger

Hello list-members!

Let's say I've a variable of type file. Is there a way to find out if it is assigned and the file is opened?

Thank's in advance,

ciao,

Olaf

Reply by email

Jonas Maebe
to Olaf Leidinger
Olaf Leidinger wrote
Let's say I've a variable of type file. Is there a way to find out if it is assigned and the file is opened?

Not really. It's sort-of possible by copying the internal structure from the RTL and checking certain fields, but even that method isn't fool-proof (since it's possible that an uninitialized file variale "accidentally" contains valid values). You really should structure your program so that at any time, it knows in what state a certain file (or any other variable) is.

Jonas

Reply by email

Olaf Leidinger
to Jonas Maebe

----- Original Message -----

Earlier message 27 lines
From: "Jonas Maebe" To: Sent: Monday, July 22, 2002 1:03 AM Subject: Re: [fpc-pascal]file > > > On Sun, 21 Jul 2002, Olaf Leidinger wrote: > > > Let's say I've a variable of type file. Is there a way to find out if > > it is assigned and the file is opened? > > Not really. It's sort-of possible by copying the internal structure from > the RTL and checking certain fields, but even that method isn't fool-proof > (since it's possible that an uninitialized file variale "accidentally" > contains valid values). You really should structure your program so that > at any time, it knows in what state a certain file (or any other variable) > is. Okay, I see... Thank you very much. Ciao, Olaf

Reply by email