I would like to know how i check the first character of each line before I either ignore it and move onto the next line or add it to an array.
What i am looking for is tags like <. If the line begins with that i move onto the next line until I find a line beginnging with a letter or number.
I got this code from a C++ book which has lots of very small examples but don't think it's right or something is missing but i don't know what.
This is my file which asks for a file which needs to be processed.
char FileName[20];
string line;
string sub1 = "<";
string sub2 = " ";
cout << "Please enter a filename\n";
cin >> FileName;
ifstream myfile(FileName);
while(! myfile )
{
cout << "Unable to open file: " << FileName << endl;
cout << "Please enter Gene Expression Matrix\n";
cin >> FileName;
}
while (! FileName.eof()) //Loop through lines
{
getline(FileName, line);
unsigned int pos1 = str.find(sub1, 0);
unsigned int pos2 = str.find(sub2, 0);
if(pos1 = string::npos)
if(pos2 = string::npos)
count << sub << "not found" << endl;
}
FileName.close();
return 0;