Home

HFILEERROR

HFILEERROR is a sentinel value used in legacy file I/O APIs that operate on an HFILE handle. It signals that a function attempting to return an HFILE has failed. In most documentation and code, this value is defined as an invalid handle, typically represented as -1, and cast to the HFILE type.

In the OS/2 and DOS high-level file I/O libraries, many operations such as opening, reading, writing, or

HFILE handles and the HFILE_ERROR sentinel are part of legacy 16-bit and early 32-bit environments. They were

closing
a
file
return
an
HFILE
on
success
or
HFILE_ERROR
on
failure.
A
returned
HFILE_ERROR
indicates
that
the
operation
did
not
complete,
and
the
programmer
should
handle
the
error
according
to
the
platform’s
error
reporting
conventions.
The
exact
cause
of
the
failure
is
usually
obtained
through
the
system’s
error
reporting
mechanism
associated
with
the
API,
referenced
by
the
function’s
documentation.
common
in
the
OS/2,
DOS,
and
early
Windows-era
high-level
file
I/O
libraries.
Modern
software
development
on
Windows
generally
uses
the
Win32
API
with
HANDLEs
or
standard
C
FILE
streams,
where
different
error
reporting
schemes
apply.
As
a
result,
HFILE
and
HFILE_ERROR
are
largely
of
historical
interest
and
are
rarely
used
in
contemporary
code,
except
when
maintaining
or
interfacing
with
older
applications
or
legacy
systems.