Up: GEOS SDK TechDocs | Up | Prev: FileEnumLocateAttr() ... | Next: FileOpen() ...

FileGetDiskHandle()

DiskHandle FileGetDiskHandle( /* sets thread's error value */
        FileHandle fh);

This routine returns the handle of the disk containing an open file. If unsuccessful, it sets the thread's error value (accessible via ThreadGetError() ).

Include: file.h

FileGetHandleExtAttributes()

word	FileGetHandleExtAttributes(
        FileHandle			fh,				/* open file's handle */
        FileExtendedAttribute			attr,				/* attribute to get */
        void			* buffer,				/* attribute is written here */
        word			bufSize);				/* length of buffer in bytes */

This routine gets one or more extended attributes of an open file. (To get the attributes of a file without opening it, call FileGetPathExtAttributes() .) If a single attribute is requested, the attribute will be written in the buffer passed. If several attributes are requested, attr should be set to FEA_MULTIPLE, and buffer should point to an array of FileExtAttrDesc structures. In this case, bufSize should be the number of structures in the buffer, not the length of the buffer.

If FileGetHandleExtAttributes() is successful, it returns zero. Otherwise, it returns one of the following error codes:

ERROR_ATTR_NOT_SUPPORTED
The file system does not recognize the attribute constant passed.
ERROR_ATTR_SIZE_MISMATCH
The buffer passed was too small for the attribute requested.
ERROR_ATTR_NOT_FOUND
The file does not have a value set for that attribute.
ERROR_ACCESS_DENIED
You do not have read-access to the file.

Tips and Tricks: Note that the only way to recover a custom attribute is by passing FEA_MULTIPLE, and using a FileExtAttrDesc to describe the attribute.

See Also: FileGetPathExtAttributes().

Include: file.h

FileGetPathExtAttributes()

word	FileGetPathExtAttributes(
        const char			* path,				/* path relative to current
							 * working directory */
        FileExtendedAttribute			attr,				/* attribute to get */
        void			* buffer,				/* attribute is written here */
        word			bufSize);				/* length of buffer in bytes */

This routine gets one or more extended attributes of a GEOS file. If a single attribute is requested, the attribute will be written in the buffer passed. If several attributes are requested, attr should be set to FEA_MULTIPLE, and buffer should point to an array of FileExtAttrDesc structures. In this case, bufSize should be the number of structures in the buffer, not the length of the buffer.

If FileGetPathExtAttributes() is successful, it returns zero. Otherwise, it returns one of the following error codes:

ERROR_ATTR_NOT_SUPPORTED
The file system does not recognize the attribute constant passed.
ERROR_ATTR_SIZE_MISMATCH
The buffer passed was too small for the attribute requested.
ERROR_ATTR_NOT_FOUND
The file does not have a value set for that attribute.
ERROR_ACCESS_DENIED
You do not have read-access to the file.

Tips and Tricks: Note that the only way to recover a custom attribute is by passing FEA_MULTIPLE, and using a FileExtAttrDesc to describe the attribute.

See Also: FileGetHandleExtAttributes().

Include: file.h

FileLockRecord()

word	FileLockRecord( /* returns error */
        FileHandle		fh,
        dword		filePos,			/* lock starting at this position... */
        dword		regLength);				/* lock this many bytes */

This routine puts a lock on a part of a byte file. It first checks to make sure that there are no locks that overlap the region specified; if there are, it will fail and return ERROR_ALREADY_LOCKED. If there are no locks, it will place a lock on the region specified and return zero.

Warnings: Locking a region only prevents threads from locking part of the same region; it does not prevent them from reading from or writing to the region. If applications use this mechanism, they have to make sure to call FileLockRecord before trying to access a part of a file.

See Also: FileUnlockRecord(), HandleP().

FileMove()

word	FileMove( /* Returns error */
        const char		* source,				/* source path and file name */
        const char		* dest,				/* destination path and file name */
        DiskHandle		sourceDisk,				/* These handles may be Standard */
        DiskHandle		destDisk);				/* Path constants, or null to indi- 
						 * cate current working directory */

This routine moves a file from one location to another. The source and destination are specified with path strings. Each string specifies a path relative to the location specified by the corresponding disk handle. If the handle is a disk handle, the path is relative to that disk's root. If the disk handle is a standard path constant, the path string is relative to that standard path. If the disk handle is null, the path is relative to the current working directory.

If FileMove() is successful, it returns zero. Otherwise, it returns one of the following error codes and sets the thread's error value.

ERROR_FILE_NOT_FOUND
No such source file exists in the specified directory.
ERROR_PATH_NOT_FOUND
An invalid source or destination path string was passed.
ERROR_ACCESS_DENIED
You do not have permission to delete the source file, or there is already a file with the same name as the destination file (and you do not have permission to delete it), or the destination disk or directory is not writable.
ERROR_FILE_IN_USE
Either the source file is in use, or there is already a file with the same name as the destination file, and it is in use.
ERROR_SHORT_READ_WRITE
There was not enough room on the destination disk.

See Also: FileCopy().

Include: file.h


Up: GEOS SDK TechDocs | Up | Prev: FileEnumLocateAttr() ... | Next: FileOpen() ...