windows_programming_notes.nbk: Home | Index | Next Page: GetGValue | Previous Page: GetFileTime


 GetFileType

Retrieves the file type of the specified file.

Syntax

    DWORD WINAPI GetFileType(
      __in  HANDLE hFile
    );

Parameters

Return Value

The function returns one of the following values.

Return code/value Description

FILE_TYPE_CHAR 0x0002 The specified file is a character file, typically an LPT device or a console.

FILE_TYPE_DISK 0x0001 The specified file is a disk file.

FILE_TYPE_PIPE 0x0003 The specified file is a socket, a named pipe, or an anonymous pipe.

FILE_TYPE_REMOTE 0x8000 Unused.

FILE_TYPE_UNKNOWN 0x0000 Either the type of the specified file is unknown, or the function failed.

You can distinguish between a "valid" return of FILE_TYPE_UNKNOWN and its return due to a calling error (for example, passing an invalid handle to GetFileType) by calling GetLastError.

If the function worked properly and FILE_TYPE_UNKNOWN was returned, a call to GetLastError will return NO_ERROR.

If the function returned FILE_TYPE_UNKNOWN due to an error in calling GetFileType, GetLastError will return the error code.

Requirements


windows_programming_notes.nbk: Home | Index | Next Page: GetGValue | Previous Page: GetFileTime


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time