This shows you the differences between two versions of the page.
en:examples:writing_a_file:screen_shots [2021/11/29 12:30 (4 years ago)] – created sausage | en:examples:writing_a_file:screen_shots [2021/11/30 02:06 (4 years ago)] (current) – removed sausage | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 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. | ||
- | |||
- | <code cpp> | ||
- | 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 (" | ||
- | orxFile_Print(file, | ||
- | orxFile_Close(file); | ||
- | } | ||
- | </ | ||