Modify

#3882 assigned Feature Request

IsFileHandle(<AutoIt filehandle as returned by FileOpen)

Reported by: RTFC Owned by: Jon
Milestone: Component: AutoIt
Version: Severity: None
Keywords: filehandle Cc:

Description (last modified by mLipok)

I would like to write UDFs that (just like FileOpen) accept as input either valid filename OR (AutoIt) filehandle (actually an integer), but there is no way for me to check whether any integer parsed as a filehandle is referring to a currently valid file previously opened with FileOpen. For the moment I'm using this hack:

Func _IsValidFileHandle($fh)
        FileGetPos($fh)         ; non-invasive interaction
        Return (@error=0)       ; an invalid (integer) AutoIt file handle triggers an error
EndFunc

But since various file functions already error out when an invalid AutoIt filehandle is parsed, it must be trivial to implement an IsFileHandle() function to perform this check internally.

Attachments (0)

Change History (4)

comment:1 by TicketCleanup, on May 11, 2022 at 9:00:02 AM

Version: 3.3.14.0

Automatic ticket cleanup.

comment:2 by mLipok, on May 11, 2022 at 3:10:19 PM

Description: modified (diff)

comment:3 by Jpm, on May 16, 2022 at 7:50:35 AM

Owner: set to Jpm
Status: newassigned

Fix sent to Jon

comment:4 by Jpm, on Mar 16, 2024 at 10:28:28 AM

Owner: changed from Jpm to Jon

Modify Ticket

Action
as assigned The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.