For some reason I’m unable to write to file using ofFile(). of_v0.10.1_vs2017_release. See example below, what am I doing wrong?
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
string data = "TEST!";
ofFile userDataFile(ofToDataPath("userData.json"));
userDataFile.create();
if (!userDataFile.canWrite()) ofLogNotice("setup") << "Cannot write to userData.json!" << endl;
userDataFile << data;
userDataFile.close();
ofLogNotice("setup") << "Just finished writing to and closing userData.json." << endl;
}
The file gets created but is empty (0kb size).