src/sgp/FileMan.cc
/** Get file open modes from our enumeration.
 * Abort program if conversion is not found.
 * @return file mode for fopen call and posix mode using parameter 'posixMode' */
Get file open modes from our enumeration.
Abort program if conversion is not found.
@return file mode for fopen call and posix mode using parameter 'posixMode'
Get file open modes from our enumeration . Abort program if conversion is not found . @return file mode for fopen call and posix mode using parameter ' posixMode '
static const char* GetFileOpenModes(FileOpenFlags flags, int *posixMode)
{
	const char *cMode = NULL;
#ifndef _WIN32
	*posixMode = 0;
#else
	*posixMode = O_BINARY;
#endif
	switch (flags & (FILE_ACCESS_READWRITE | FILE_ACCESS_APPEND))
	{
		case FILE_ACCESS_READ:      cMode = "rb";  *posixMode |= O_RDONLY;            break;
		case FILE_ACCESS_WRITE:     cMode = "wb";  *posixMode |= O_WRONLY;            break;
		case FILE_ACCESS_READWRITE: cMode = "r+b"; *posixMode |= O_RDWR;              break;
		case FILE_ACCESS_APPEND:    cMode = "ab";  *posixMode |= O_WRONLY | O_APPEND; break;
		default: abort();
	}
	return cMode;
}
static const char * GetFileOpenModes ( FileOpenFlags flags , int * posixMode ) { const char * cMode = NULL ; #ifndef _WIN32 * posixMode = 0 ; #else * posixMode = O_BINARY ; #endif switch ( flags & ( FILE_ACCESS_READWRITE | FILE_ACCESS_APPEND ) ) { case FILE_ACCESS_READ : cMode = " " ; * posixMode |= O_RDONLY ; break ; case FILE_ACCESS_WRITE : cMode = " " ; * posixMode |= O_WRONLY ; break ; case FILE_ACCESS_READWRITE : cMode = " " ; * posixMode |= O_RDWR ; break ; case FILE_ACCESS_APPEND : cMode = " " ; * posixMode |= O_WRONLY | O_APPEND ; break ; default : abort ( ) ; } return cMode ; }
Get file open modes from our enumeration.
Get file open modes from our enumeration .