Hi, I’m trying to save some data to a plain text file in the iphone documents directory. Does anyone have an example of how to do this?
I don’t want to use the xmlSettings addon as I need the output to be in text file format. I’ve also tried some straight c++ as in this forum: http://forum.openframeworks.cc/t/how-do-i-save-to-a-file/3749/0 with no luck.
// create or open a file
string filename = “myfile.txt”;
File pFile = fopen((ofxiPhoneGetDocumentsDirectory() + filename).c_str(),“w”);
// add some lines of text
string line = “saving some data \n”;
// save file
if you are in 007 also:
ofFile file(ofxiPhoneGetDocumentsDirectory() +"filename.txt",ofFile::WriteOnly);
file << "saving some data";