User Tools

Site Tools


en:examples:writing_a_file

Writing a file to disk

A short function to demonstrate writing strings to a file. If append (orxTRUE) is passed, the string is appended to the file. If orxFALSE is passed, the string overwrites the existing contents.

void AppendToFile(const orxSTRING string, orxBOOL append){
	orxS32 flags = orxFILE_KU32_FLAG_OPEN_APPEND | orxFILE_KU32_FLAG_OPEN_WRITE;
	if (append == orxFALSE){
		flags =  orxFILE_KU32_FLAG_OPEN_WRITE;
	}
 
	orxFILE *file = orxFile_Open ("my_file_on_disk.txt", flags); 	
	orxFile_Print(file, string);
	orxFile_Close(file);
}

en/examples/writing_a_file.txt · Last modified: 2021/11/29 18:06 (2 years ago) by sausage