• Please review our updated Terms and Rules here

is ZERO an invalid dos file handle?

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
2,264
Location
USA
Returned by the create 3ch or open 3df API functions. Obviously the cflag determines success or failure, but on success, is 0 a valid returned dos file handle value? If not, what isn't a valid value -1 (0xffff)?
 
That part is clear; what I'm trying to figure out is if there is a handle value that isn't valid.
 
I don't think there is. If CARRY is ZERO then the range of handles would theoretically be from 0 to 65535.
 
Last edited:
I was hoping there is a value such as 65535 that DOS would never return, but perhaps that isn't the case!
 
There probably are values that different DOSes will never generate but an application certainly shouldn't rely on it since a different DOS might have different excluded values. Assume any value DOS provides is for an actual file handle.

The DOS source is out there. Look at how the file handle values are generated.
 
I was thinking of looking at the DOS source. I can see that in the C runtime they are only using a char to store the handle returned by DOS, so apparently they did not think it would be bigger than 127 or 255. I'm going to assume DOS will never return -1/0xffff.
 
Back
Top