MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / File_Open_Ex

Function File_Open_Ex

src/file.c:666–682  ·  view source on GitHub ↗

* Open a file for reading/writing/appending. * * @param filename The name of the file to open. * @param mode The mode to open the file in. Bit 1 means reading, bit 2 means writing. * @return An index value refering to the opened file, or FILE_INVALID. */

Source from the content-addressed store, hash-verified

664 * @return An index value refering to the opened file, or FILE_INVALID.
665 */
666uint8 File_Open_Ex(enum SearchDirectory dir, const char *filename, uint8 mode)
667{
668 uint8 res;
669
670 res = _File_Open(dir, filename, mode);
671
672 if (res == FILE_INVALID) {
673 if(dir == SEARCHDIR_PERSONAL_DATA_DIR) {
674 Warning("Unable to open file '%s'.\n", filename);
675 } else {
676 Error("Unable to open file '%s'.\n", filename);
677 exit(1);
678 }
679 }
680
681 return res;
682}
683
684/**
685 * Close an opened file.

Callers 2

File_ReadBlockFile_ExFunction · 0.85
ChunkFile_Open_ExFunction · 0.85

Calls 3

_File_OpenFunction · 0.85
WarningFunction · 0.50
ErrorFunction · 0.50

Tested by

no test coverage detected