P
puzzlecracker
I want to read lines and skip blank lines:
would this work considering the lines can contain tabs, spaces, etc.?
file.in:
------
line1
line2
line3
...
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main(int argc, char *argv ){
read(argv[1]);
}
void read(char * filename){
infile in(filename);
string line;
while(getline(in, line)&&line!="")
//do something
in.close();
}
well just look at read..
thanks
would this work considering the lines can contain tabs, spaces, etc.?
file.in:
------
line1
line2
line3
...
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main(int argc, char *argv ){
read(argv[1]);
}
void read(char * filename){
infile in(filename);
string line;
while(getline(in, line)&&line!="")
//do something
in.close();
}
well just look at read..
thanks