Is there a simple way to import txt files or urls?
I think i got that part using fopen, but i was hoping for a simpler way in OF.http://www.cs.bu.edu/teaching/c/file-io/intro/
Once i have imported strings, how do i convert them to ints or floats?
A simple example would be very helpful. Sorry if this is obvious. It seems like a very basic thing that i should be able to do, but i couldn’t find anything in the OF documentation.
There is a handy C++ way to write and load text files. With the stream operator type conversion is pretty much seamless 
This is some code I have lying around …
void Calibrator::saveSettings() {
ofstream fout;
fout.open( ofToDataPath("calibration.txt").c_str() );
fout << translation.x << " " << translation.y << endl
<< rotAngle << endl
<< scale.x << " " << scale.y << endl
<< A.x << " " << A.y << endl
<< B.x << " " << B.y << endl
<< C.x << " " << C.y << endl
<< D.x << " " << D.y << endl
<< camIntrinsics[0] << " " << camIntrinsics[4] << endl
<< camIntrinsics[2] << " " << camIntrinsics[5] << endl
<< distortionCoeffs[0] << " " << distortionCoeffs[1] << endl
<< distortionCoeffs[2] << " " << distortionCoeffs[3] << endl;
fout.close();
}
void Calibrator::loadSettings() {
ifstream fin;
fin.open( ofToDataPath("calibration.txt").c_str() );
fin >> translation.x >> translation.y
>> rotAngle
>> scale.x >> scale.y
>> A.x >> A.y
>> B.x >> B.y
>> C.x >> C.y
>> D.x >> D.y
>> camIntrinsics[0] >> camIntrinsics[4]
>> camIntrinsics[2] >> camIntrinsics[5]
>> distortionCoeffs[0] >> distortionCoeffs[1]
>> distortionCoeffs[2] >> distortionCoeffs[3];
fin.close();
}
My file typically looks like this:
12.5 4.5
0
0.97 0.97
0 0
320 0
320 240
0 240
5400 5100
170 154
-103 -334
-0.3 -1.63913e-08
Hope that helps,