Are you familiar with streams? Consider this:
Code:
std::ifstream inp("input.data");
std::ofstream oup("output.txt");
if( !inp || !oup)
{
std::cerr << "Holy crap!" << std::endl;
throw error();
}
So then you could either
Code:
oup << "Invoice version blah blah....." << std::endl;
while(inp >> data_obj_built_for_streams)
oup << data_obj_built_for_streams;
or you could
Code:
std::string buffer;
oup << "Invoice version blah blah....." << std::endl;
while(std::getline(inp,buffer))
{
oup << processing_function_that_returns_a_string(buffer) << '\n';
}
//of course, your processing function would do the dirty work
//of parsing the input and reorganizing it. However, for your
//model that might not be necessary.
Or something like that. Hell, you could even do away with the output function altogether
and just hope the input's alright as is.
You could also write a class (or set of utilities in a namespace) that keeps track of products with maps and stuctures and functions, so you can do all sorts of fun stuff. But for what you need so far, the above code concepts should suffice.