A
Adam Balgach
Greetings all, i am trying to parse up a CSV Comma delmited file from
microsoft (gasp) excel. And then use that data to convert it to
another file format (.arff). in any event, i am having a bunch of
trouble trying to get the individual lines. If i open the .csv in
emacs then it appears that there are eoln characters (/n) however,
when i attempt to use iostream::getline(char*, int, char) it seems to
be failing on finding the end of line. im using the code:
ifstream input;
input.open("test_data.csv");
if (!input.good()) {
cerr << "Error opening\n";
exit(0);
}
char line[1024];
input.getline(line,1024,'\t'); //gets the first line in the file
int pos=0;
cout << "First Line: "<<line;
what its basically doing is reading past the first end of line and
reading exactly 1024 characters. Has anyone worked with csv files
before? Please let me know. Thanks!
Cheers,
Adam.
microsoft (gasp) excel. And then use that data to convert it to
another file format (.arff). in any event, i am having a bunch of
trouble trying to get the individual lines. If i open the .csv in
emacs then it appears that there are eoln characters (/n) however,
when i attempt to use iostream::getline(char*, int, char) it seems to
be failing on finding the end of line. im using the code:
ifstream input;
input.open("test_data.csv");
if (!input.good()) {
cerr << "Error opening\n";
exit(0);
}
char line[1024];
input.getline(line,1024,'\t'); //gets the first line in the file
int pos=0;
cout << "First Line: "<<line;
what its basically doing is reading past the first end of line and
reading exactly 1024 characters. Has anyone worked with csv files
before? Please let me know. Thanks!
Cheers,
Adam.