Up: GEOS SDK TechDocs | Up | Prev: ElementArrayRemoveReference() ... | Next: FileCreate() ...

FatalError()

void	FatalError(
        word errorCode);

This routine causes a fatal error, leaving errorCode for the debugger.

FileClose()

word 	FileClose( /* returns error */
        FileHandle		fh,					/* File to close */
        Boolean		noErrorFlag);					/* Set if app. can't handle
								 * errors */

This routine closes an open byte file. If the routine succeeds, it returns zero. If the routine fails and noErrorFlag is false (i.e., zero), FileClose() returns a member of the FileError enumerated type. If the routine fails and noErrorFlag is true (i.e., non-zero), the routine will fatal-error.

Warnings: The noErrorFlag parameter should be true only during debugging.

Include: file.h

FileCommit()

word	FileCommit( /* returns error */
        FileHandle		fh,
        Boolean		noErrorFlag);				/* set if can't handle errors */

FileCommit() forces the file system to write any cached information about a file to the disk immediately. If it is successful, it returns zero. If it fails, it returns an error code. If the routine fails and noErrorFlag is true (i.e. non-zero), the routine will fatal-error.

Warnings: The noErrorFlag parameter should be true only during debugging.

Include: file.h

FileConstructFullPath()

DiskHandle 	FileConstructFullPath(
        char		* * buffer,				/* Path string is written here */
        word		bufSize,			/* Length of buffer (in bytes) */
        DiskHandle		disk,			/* Disk or standard path; null for 
						 * current path */
        const char		* tail,			/* Path relative to handle */
        Boolean		addDriveLetter);					/* Should path begin with drive
								 * name? */

This routine translates a GEOS directory specification into a complete path string. It writes the string into the passed buffer. The directory is specified by two arguments: The first, disk , is the handle of a disk; this may also be a standard path constant. (If a null handle is passed, the current working directory is used.) The second, tail , is a pointer to the character string representing the tail end of the path. FileConstructFullPath() appends this relative path to the location indicated by the disk handle. It then constructs a full path string, beginning with that disk's root directory, and writes it to the buffer passed. If addDriveName is true (i.e. non-zero), the path string will begin with the drive's name and a colon. The pointer pointed to by buffer will be updated to point to the end of the constructed string.

Examples: The following call to FileConstructFullPath() might yield these results:

Sample call to FileConstructFullPath()

/* Here we find out the full path of a subdirectory of the DOCUMENT directory */
	DiskHandle		documentDisk;
	char		pathBuffer[256];			/* long enough for most paths */
	char		*pB = &pathBuffer;
	documentDisk = FileConstructFullPath(&pB,						/* pointer to pointer */
					256, 		/* Length of buffer */
					SP_DOCUMENT,		/* This can be a disk or 
							 * standard path */
					"MEMOS\\JANUARY", /* In C strings, the
							 * backslash must be
							 * doubled */
					TRUE);		/* Prepend drive name */
/* If the standard paths are set up in the default configuration, "documentDisk"
 * would be the handle of the main hard drive, and pathBuffer would contain a
 * string like "C:\GEOWORKS\DOCUMENT\MEMOS\JANUARY" */

See Also: FileParseStandardPath().

Include: file.h

FileCopy()

word	FileCopy( /* 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 makes a copy of a file. 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 FileCopy() is successful, it returns zero. Otherwise, it returns one of the following error codes:

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 existing copy of the destination file, or the destination disk or directory is not writable.
ERROR_FILE_IN_USE
Some geode has the existing destination file open.
ERROR_SHORT_READ_WRITE
There was not enough room on the destination disk.

See Also: FileMove().

Include: file.h


Up: GEOS SDK TechDocs | Up | Prev: ElementArrayRemoveReference() ... | Next: FileCreate() ...