Name
hw_FStat -- obtain information about open file (V6.0)
Synopsis
int ok = hw_FStat(APTR fh, ULONG flags, struct hwos_StatStruct *st,
                       struct hwTagList *tags);
Function
This function writes information about the file handle passed in parameter 1 to the structure pointer passed in parameter 3. struct hwos_StatStruct looks like this:

 
struct hwos_StatStruct
{
    int Type;                               // [out]
    DOSINT64 Size;                          // [out]
    ULONG Flags;                            // [out]
    struct hwos_DateStruct Time;            // [out]
    struct hwos_DateStruct LastAccessTime;  // [out]
    struct hwos_DateStruct CreationTime;    // [out]
    STRPTR FullPath;                        // [out]
    STRPTR Comment;                         // [out]
    int LinkMode;                           // [out]
    STRPTR Container;                       // [out]
};

The following information is written to the individual structure members:

Type:
This will always be set to HWSTATTYPE_FILE.

Size:
This will be set to the size of the file in bytes or -1 if the size is not known, for example because the file is being streamed from a network source.

Flags:
Combination of flags describing the file's attributes. See File attributes for a list of supported attributes.

Time:
Time stamp indicating when this file was last modified.

LastAccessTime:
Time stamp indicating when this file was last accessed.

CreationTime:
Time stamp indicating when this file was created.

FullPath:
This will be set to a fully qualified path to the file. The string pointer used here will stay valid until the next call to hw_FStat(). If you set the HWSTATFLAGS_ALLOCSTRINGS flag, hw_FStat() will not use a static string buffer but allocate a new private string pointer for this structure member. You will have to call hw_TrackedFree() on this string when you're done with it in that case. This is useful if you need to use hw_FStat() in a multithreaded environment.

Comment:
Comment stored for this file in the file system. The string pointer returned here will stay valid until the next call to hw_FStat(). This may be NULL if the file system does not support comments for its objects. If you set the HWSTATFLAGS_ALLOCSTRINGS flag, hw_FStat() will not use a static string buffer but allocate a new private string pointer for this structure member. You will have to call hw_TrackedFree() on this string when you're done with it in that case. This is useful if you need to use hw_FStat() in a multithreaded environment.

LinkMode:
Currently unused. May contain random data.

Container:
Currently unused. May contain random data.

The following flags are supported by hw_FStat():

HWSTATFLAGS_ALLOCSTRINGS:
If you set this flag, hw_FStat() will not use static string buffers for the FullPath and Comment structure members but allocate new private string buffers for them. You will have to call hw_TrackedFree() on these buffers once you're done with them in that case. This flag is useful if you need to use hw_FStat() in a multithreaded environment.

hw_FStat() returns True on success or False on failure.

This function is only thread-safe if you set the HWSTATFLAGS_ALLOCSTRINGS flag.

Note that before Hollywood 7.1 hw_FStat() returned a wrong size when used with virtual files. This bug was fixed in Hollywood 7.1.

Designer compatibility
Supported since Designer 5.0

Inputs
handle
file handle returned by hw_FOpen()
flags
combination of flags (see above)
st
pointer to a struct hwos_StatStruct for storing information about the file
tags
reserved for future use (pass NULL)
Results
ok
True on success, False otherwise

Show TOC