Documentation from file.h |
Introduction | [top] |
ROV - Easy applications from C
Copyright - © Jason Tribbeck / 7th ARM 1994-2001
Contributing authors - Jason Tribbeck
File - file.h
Type - helper
Description
The file helper performs a large number of standard file-based functions, such as loading, saving, creating directories and so forth.
file_size | [top] |
Get the file size.
Parameters:
- char *file_name - the name of the file.
Returns:
- the size of the file, or -1 if size could not be determined (file not found, for example).
int file_size(char *file_name);See also: file_getattr(), file_getdate(), file_getexecaddr(), file_getloadaddr(), file_gettype(), file_sizetostr()
file_direxists | [top] |
Check the existence of a directory.
Parameters:
- char *dir_name - the name of the directory.
Returns:
- non-zero if the directory exists.
int file_direxists(char *dir_name);
file_directoryexists (definition) | [top] |
Synonymn for file_direxists.
Parameters:
- n - the name of the directory to check.
#define file_directoryexists(n) file_direxists(n)See also: file_direxists()
file_load | [top] |
Load a file into memory.
Parameters:
- char *file_name - the name of the file.
- void *data_ptr - the pointer to where the file should be loaded.Returns:
- the length of the file loaded, or -1 if the file could not be loaded.
Note - data_ptr must point to an area of memory that has sufficient space to read the file.
int file_load(char *file_name, void *data_ptr);
file_savetype | [top] |
Save a file with a file type.
Parameters:
- char *file_name - the name of the file to save.
- void *data_ptr - the pointer to where the file is stored in memory.
- int data_size - the size of the file to save.
- int file_type - the file type to save as.Returns:
- an error block if an error occurred, or NULL if successful.
_kernel_oserror * file_savetype(char *file_name, void *data_ptr, int data_size, int file_type);See also: file_save(), file_savewithdate()
file_save | [top] |
Save a file with a given load/exec address
Parameters:
- char *file_name - the name of the file to save.
- void *data_ptr - the pointer to where the file is stored in memory.
- int data_size - the size of the file to save.
- int load_addr - the load address of the file.
- int exec_addr - the execution address of the file.Returns:
- an error block if an error occurred, or NULL if successful.
_kernel_oserror * file_save(char *file_name, void *data_ptr, int data_size, int load_addr, int exec_addr);See also: file_savetype(), file_savewithdate()
file_savewithdate | [top] |
Save a file with a file type and a certain date.
Parameters:
- char *file_name - the name of the file to save.
- void *data_ptr - the pointer to where the file is stored in memory.
- int data_size - the size of the file to save.
- int file_type - the file type to save as.
- date_str *date - the date the file should be saved as.Returns:
- an error block if an error occurred, or NULL if successful.
_kernel_oserror * file_savewithdate(char *file_name, void *data_ptr, int data_size, int file_type, date_str *date);See also: file_getcurrentdate(), file_save(), file_savewithdate()
file_gettype | [top] |
Get the type of a file
Parameters:
- char *file_name - the name of the file.
Returns:
- the file type (or 0x1000 for a directory, 0x2000 for an application, or -1 for unable to get the type).
int file_gettype(char *file_name);See also: file_getattr(), file_getdate(), file_getexecaddr(), file_getloadaddr(), file_settype(), file_size()
file_getloadaddr | [top] |
Get the load address of a file.
Parameters:
- char *file_name - the name of the file.
Returns:
- the load address (or -1 if unable to get the address).
int file_getloadaddr(char *file_name);See also: file_getattr(), file_getdate(), file_getdatefromloadexec(), file_getexecaddr(), file_gettype(), file_size(), file_typetostr()
file_getexecaddr | [top] |
Get the execution address of a file.
Parameters:
- char *file_name - the name of the file.
Returns:
- the load address (or -1 if unable to get the address).
int file_getexecaddr(char *file_name);See also: file_getattr(), file_getdate(), file_getdatefromloadexec(), file_getloadaddr(), file_gettype(), file_size()
file_getsize (definition) | [top] |
Synonym for file_size()
#define file_getsize(n) file_size(n)See also: file_size()
file_getattr | [top] |
Get the file attributes.
Parameters:
- char *file_name - the name of the file.
Returns:
- the file attributes
int file_getattr(char *file_name);See also: file_copyattributes(), file_getdate(), file_getexecaddr(), file_getloadaddr(), file_getsize(), file_gettype()
file_getdate | [top] |
Get the date of a file.
Parameters:
- char *file_name - the name of the file.
- date_str *date - the memory block to hold the date.void file_getdate(char *file_name, date_str *date);See also: file_datecmp(), file_datetostr(), file_getattr(), file_getcurrentdate(), file_getdatefromloadexec(), file_getexecaddr(), file_getloadaddr(), file_getsize(), file_gettype()
file_getcurrentdate | [top] |
Get the current date
Parameters:
- date_str *date - the memory block to hold the date.
void file_getcurrentdate(date_str *date);See also: file_datecmp()
file_settype | [top] |
Sets the type of a file.
Parameters:
- char *file_name - the file name.
- int file_type - the file type to set it to.Returns:
- non-zero for success.
BOOL file_settype(char *file_name, int file_type);See also: file_gettype()
file_createdirectory | [top] |
Create a directory.
Parameters:
- char *dir_name - the directory name to create.
Returns:
- non-zero for success.
BOOL file_createdirectory(char *dir_name);See also: file_create()
file_create | [top] |
Create a file.
Parameters:
- char *file_name - the file name to create.
- int file_size - the size of the file to create.Returns:
- non-zero for success.
BOOL file_create(char *file_name, int file_size);
file_copyattributes | [top] |
Copies attributes from one file to another.
Parameters:
- char *dst_name - the destination file name.
- char *src_name - the source file name.void file_copyattributes(char *dst_name, char *src_name);
file_datetostr | [top] |
Converts a date into a string.
Parameters:
- date_str *date - the pointer to the date block.
Returns:
- a pointer to the string date.
Note - The string must be copied to another memory area before this function can be called again.
char *file_datetostr(date_str *date);
file_typetostr | [top] |
Converts a file type into a string.
Parameters:
- int type - the file type to convert.
Returns:
- a pointer to the string type.
Note - The string must be copied to another memory area before this function can be called again.
char *file_typetostr(int type);
file_sizetostr | [top] |
Converts a file size into a string.
Parameters:
- int size - the file size to convert.
Returns:
- a pointer to the string size.
Note - The string must be copied to another memory area before this function can be called again.
char *file_sizetostr(int size);
file_leaf | [top] |
Gets the leafname of the file.
Parameters:
- char *file_name - the full file name.
Returns:
- a pointer to the leaf portion of the full file name.
Note - The pointer returned is always inside the string that was passed into this function.
char *file_leaf(char *file_name);
file_getdatefromloadexec | [top] |
Work out the date from a given load and execution address.
Parameters:
- int load_addr - the load address.
- int exec_addr - the execution address.
- date_str *date - the memory block to hold the converted date.void file_getdatefromloadexec(int load_addr, int exec_addr, date_str *date);
file_datecmp | [top] |
Compare two dates
Parameters:
- date_str *date1 - the pointer to the first date.
- date_str *date2 - the pointer to the second date.Returns:
- positive if date1 < date2, 0 if date1 = date 2, or negative if date1 > date2.
int file_datecmp(date_str *date1, date_str *date2);
file_setloadexecattr | [top] |
Set the load address, execution address and attributes of a file.
Parameters:
- char *file_name - the name of the file.
- int load_addr - the load address.
- int exec_addr - the execution address.
- int attr - the file attributesReturns:
- non-zero if successful.
int file_setloadexecattr(char *file_name, int load_addr, int exec_addr, int attr);
Generated Thu Feb 7 23:22:51 2002