Hey. I have just joined and my skills in C++ are more or less no existen but still better than me trying to learn python or smth which supposedly is more adequate for the task as i am told.
Any way I have a data file which consits of observational data in the below format
Name=Observation1
DNU=
Nu=
...
% Some values %
END
Name=Observation2
DNU=
Nu=
...
% Some values %
END
This repeats for quite some time. I was wondering if it is possible to create a program to dump each of these until the respective ENDs into a new .txt file.
My attempt so far
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string filename;
cout << "Which file?\n";
cin >> filename;
ifstream sourcefile;
sourcefile.open (filename".asc");
if(!indata) { // file couldn't be opened
cerr << "Error: file could not be opened" << endl;
exit(1);
}
string outputname
cout << "Where to?\n";
cin >> outputname;
ofstream outputfile;
outputfile.open(outputname".txt");
do{
outputfile << sourcefile
}while(!sourcefile.eof() && size_t find_first_of="END")
Any help is greatly appreciated! Don't mind pointers to links of similiar problems to figure it out by myself if you aren't comfortable with giving a straight answer :)
Max