Hi so this code worked 5 minutes ago to do exactly what I needed it to do.
The data is:
Set Field [G],Sheet Resistivity (Gavg) [ohm/sqr]
0.0000E+0,
0.0000E+0,7.270620E+2
1.0000E-2,
1.0000E-2,7.271280E+2
-1.0000E-2,
-1.0000E-2,
-1.0000E-2,7.271290E+2
And my code for it is:
#include <iostream>
#include <fstream>
using namespace std;
int main(){
ifstream ip("/Users/10Exahertz/Documents/Hall Data/Test/data.txt");
if(!ip.is_open()) std::cout << "ERROR: File Open" << '\n';
string x;
string y;
while(getline(ip,x,',')){
getline(ip,y,'\n');
if(y!="")
std::cout <<x<<","<< y << '\n';
}
ip.close();
}
Like I said 5 mintues ago this worked, it got rid of the rows with an empty y string and all was good. But then I went back to the original data file and it didnt work there. I was confused so I put the original data into data.txt and now that one is not working either. Im honestly confused, but what would be the best condition in that if loop to make it so this works.