Here is a part of my code:
Code:
string open( sting file_name)
/*
* open the file
* read the lines one by one
* delete the comeents ( lines or after the command
* ignor the TAB at the begining.
*/
{
fstrem in_file;
in_file.open(file_name.c_str(), ios::in)
int lines= 0;
string code_line;
getline(in_file, code_line);
while(!in_file.eof())
//handel Empty lines
while(code_line.size() == 0 && !in_file.eof()){
getline(in_file, code_line);
lines ++;
}
// handel Comments after the command
if( line_code.find("!") != -1){
line_code= line_code.erase(line_code.find("!"), line_code.size());
}
// handel comment lines.
while((strcmp(line_code.c_str)(,"")==) && !in_file.eof()){
getline(in_file, line_code);
lines++;
}
// reading from the file and ignoring the TAB.
/*
I don't know how to do it
*/
cout<<" Thank you for your help";
//end of function open and read the file
}
The project is very big but I want the input file to look nice, so I thought about having a TAB, but I end up having this problem.
I want to learn how to deal with TABs at the begining of the lines for future as well.
Thank you for your help and support.