EDIT - there are no blank lines. EDIT 2 - my bad, it seems I was wrong all along. There is a blank line somewhere, although the csv file indicates otherwise. It's working now. Okay so here is the entire (short) program:
#include <iostream>
#include <cctype>
#include <string>
#include <fstream>
using namespace std;
int main(){
char a;
string stringmanip;
fstream myfile("readthisfile.csv");
if (myfile.is_open()){
while ( myfile.good() ){
getline(myfile,stringmanip);
a=stringmanip[0];
}
myfile.close();
}
else cout<< "Unable to open file";
return 0;
}
It makes no sense to me. I can copy stringmanip, I can cout stringmanip, I can use .substr with stringmanip. If I define a regular string I can use the [] operation just fine. I've tried .at as well, but that only leads to another error. (Out of range).
Any help would be GREATLY appreciated. Sorry I'm such a beginner, as I'm sure you can tell.
Thanks, Ben