Jones
2006.06.03, 02:55 PM
I've just finished the first part of FLX's file handling system, which it will use itself primarily, but will also be available to the user, of course.
Here are the calls, and the results of each function:
FLX_findOpenFileSlot() - will find the first open slot in FLX's file array.
FLX_locateFileSlot(int *name) - will find a specific file in the array.
FLX_loadFile(char *path, char *read_or_write, int *name) - will load a text file into the FLX file array and give it the name the user designates.
FLX_closeFile(int *name) - schedules the named file for deletion. (From the array!)
FLX_cleanFiles() - deletes all files scheduled for demolition.
FLX_checkFiles() - check the array for files with matching names, that would be an error, but FLX would plow on anyway, deleting/finding the FIRST file with that name. If you're smart, you'll name all your file slot differently and never need this command. It's probably quite system costly, as it use nested while loops.
Do you think these would be easy enough to work with? The next batch will include FLX_loadCharFromFile & FLX_loadIntFromFile, to get ints and chars out of the file data in the array.
I just wondered if any of you actually see these as useful, or would suit the most common programming style?
An example of them in use:
// myName represents 35, which is a perfectly valid file code. Any int is.
int myName = 35;
int main() {
// Load myfile.txt in read mode, with the name myName.
FLX_loadFile("myfile.txt", "r", myName);
// Get the FLX subsystem slot number, you'd never need this. ;)
int theSlot = FLX_locateFileSlot(myName);
cout << "This slot: " << theSlot << endl;
// Designate the file as demolition-ready, and clean the array.
FLX_closeFile(myName);
FLX_cleanFiles();
return 0;
}
Of course, none of these have any real applicable use yet, I just wondered if they appeared useful.
Jeez sounds kinda stupid now. :D
Anyway, once the set is finished they'll be great. :wow:
I just wanted your opinions.
Thanks.
Here are the calls, and the results of each function:
FLX_findOpenFileSlot() - will find the first open slot in FLX's file array.
FLX_locateFileSlot(int *name) - will find a specific file in the array.
FLX_loadFile(char *path, char *read_or_write, int *name) - will load a text file into the FLX file array and give it the name the user designates.
FLX_closeFile(int *name) - schedules the named file for deletion. (From the array!)
FLX_cleanFiles() - deletes all files scheduled for demolition.
FLX_checkFiles() - check the array for files with matching names, that would be an error, but FLX would plow on anyway, deleting/finding the FIRST file with that name. If you're smart, you'll name all your file slot differently and never need this command. It's probably quite system costly, as it use nested while loops.
Do you think these would be easy enough to work with? The next batch will include FLX_loadCharFromFile & FLX_loadIntFromFile, to get ints and chars out of the file data in the array.
I just wondered if any of you actually see these as useful, or would suit the most common programming style?
An example of them in use:
// myName represents 35, which is a perfectly valid file code. Any int is.
int myName = 35;
int main() {
// Load myfile.txt in read mode, with the name myName.
FLX_loadFile("myfile.txt", "r", myName);
// Get the FLX subsystem slot number, you'd never need this. ;)
int theSlot = FLX_locateFileSlot(myName);
cout << "This slot: " << theSlot << endl;
// Designate the file as demolition-ready, and clean the array.
FLX_closeFile(myName);
FLX_cleanFiles();
return 0;
}
Of course, none of these have any real applicable use yet, I just wondered if they appeared useful.
Jeez sounds kinda stupid now. :D
Anyway, once the set is finished they'll be great. :wow:
I just wanted your opinions.
Thanks.