Lazarus
Free Pascal => Beginners => Topic started by: joho on August 28, 2017, 08:57:31 pm
-
Building a Win32 console mode application, I was using FileOpen ... something like:
VAR
FH : THandle;
BEGIN
FH := FileOpen ('DoesNotExist', fmOpenRead);
if (FH = -1) then
Writeln ('No go');
..
..
END;
So I get a warning that FH (of type THandle) may never return -1 ... but I was under the impression that THandle was a LONGINT ... which is signed, no?
So if I can't use -1 as an "error return", what am I to check for (apart from the unsigned variant ... )?
-
feInvalidHandle or THandle(-1)
-
Thank you, silly me for reading the docs :)
-
You are welcome. The short answer was not meant to imply the question was silly. Do not hesitate to ask when in doubt. :)
-
No offense taken (my skin is way too old for that) :)
The -1 reference I found was from the docs, so I *was* trying to be a good person and RTFM before asking.
There'll be many more questions I'm sure.