!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> GEOS C Routines: FileRename() ...
Up: GEOS SDK TechDocs | Up | Prev: FileOpen() ... | Next: FileSetHandleExtAttributes() ...

FileRename()

word	FileRename(
        const char * oldName,				/* Relative to working directory */
        const char * newName);				/* Name only, without path */

This routine changes a file's name. It cannot move a file to a different directory; to do that, call FileMove() . If the routine is successful, it returns zero; otherwise, it returns a FileError . Common errors include

ERROR_FILE_NOT_FOUND
No such file exists in the specified directory.
ERROR_PATH_NOT_FOUND
An invalid path string was passed.
ERROR_ACCESS_DENIED
You do not have permission to delete that file, or it exists on a read-only volume.
ERROR_FILE_IN_USE
Some geode has that file open.
ERROR_INVALID_NAME
The name was not a valid GEOS name; or the file is a non-GEOS file, and the name was not an appropriate native name.

See Also: FileMove().

Include: file.h

FileResolveStandardPath()

DiskHandle FileResolveStandardPath(
        char		** buffer,				/* Write path here; update pointer
						 * to point to end of path */
        word		bufSize,				/* Size of buffer (in bytes) */
        const char *		path,				/* Relative path of file */
        FileResolveStandardPathFlags flags,							/* Flags are described below */
        FileAttrs *attrsPtr);							/* Empty buffer, will be filled with attrs of passed file, if any */

This routine finds a file relative to the current location, then writes the full path to the file, starting at the root of the disk ( not at a standard path). It writes the path to the passed buffer, updating the pointer to point to the null at the end of the path string; it also returns the handle of the disk. If it cannot find the file it returns a null path.

Structures: A record of FileResolveStandardPathFlags is passed to FileResolveStandardPath() . The following flags are available:

FRSPF_ADD_DRIVE_NAME
The path string written to the buffer should begin with the drive name (e.g., "C:\GEOWORKS\DOCUMENT\MEMOS").
FRSPF_RETURN_FIRST_DIR
FileResolveStandardPath() should not check whether the passed path actually exists; instead, it should assume that the path exists in the first directory comprising the standard path, and return accordingly.

Include: file.h

FileSetAttributes()

word	FileSetAttributes( /* returns error value */
        const char		* path,			/* file's path relative to current
					 * working directory */
        FileAttrs		attr);			/* new attributes for the file */

This routine changes the standard DOS attributes of a DOS or GEOS file. Note that you can also change the attributes of a file by setting the extended attribute FEA_FILE_ATTR.

See Also: FileAttrs, FileGetAttributes().

Include: file.h

FileSetCurrentPath()

DiskHandle FileSetCurrentPath(
        DiskHandle		disk,			/* May be a standard path constant */
        const char		* path);			/* path string, null-terminated */

This routine changes the current path. It is passed two parameters: The first is the handle of the disk containing the new current path (this may be a standard path constant). The second is a null-terminated path string. It is specified with normal DOS conventions: directories are separated by backslashes; a period (".") indicates the current directory; and a pair of periods ("..") indicates the parent of the current directory. The string may not contain wildcard characters.

If disk is a disk handle, the path is relative to the root directory of that disk; if disk is a standard path constant, the path is relative to the standard path; if it is null, the path is relative to the current working directory. FileSetCurrentPath() returns the disk handle associated with the new current path; this may be a standard path constant. If FileSetCurrentPath() fails, it returns a null handle.

See Also: FileSetStandardPath().

Include: file.h

FileSetDateAndTime()

word	FileSetDateAndTime( /* returns error */
        FileHandle		fh,					/* handle of open file */
        FileDateAndTime		dateAndTime);					/* new modification time */

This routine changes a file's last-modification time-stamp. This routine can be called on GEOS or non-GEOS files. Note that you can also change the modification time of a file by changing the extended attribute FEA_MODIFICATION. If unsuccessful, this routine returns an error and sets the thread's error value (accessible via ThreadGetError() ).

See Also: FileDateAndTime, FileGetDateAndTime().

Include: file.h


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