Hi,
I think I have not really understood how stringstreams work in c++. I have this code:
Code:
const char* CAPFILEPREFIX = "cap";
const char* CAPFILESUFFIX = "lst";
int main(int argc,char** argv)
{
[definitions skipped]
stringstream name(stringstream::in|stringstream::out); // formatter
// determine number of cams to capture
if(argc < 2)
cout << "Usage: calibRecord <numberOfCams>" << endl;
else
name << argv[1];
name >> camcount;
[code skipped]
name.str(string(""));
// name.sync();
name << string(CAPFILEPREFIX) << i;
name << "." << string(CAPFILESUFFIX);
cout << name.str().c_str() << endl; [debug]
outs.push_back(new ofstream(name.str().c_str(),ios::trunc));
[code skipped]
}
Unfortunately the debug output is just an emtpy line. It seems name is initialised with the emtpy string, but filling with '<<' operator again does not work.
What is wrong?
bye,
devas