#include <fstream>
#include <string>
#include <vector>
#include <cassert>
using namespace std ;
int main()
{
const char DELIM = '>' ;
const char* const file_name = "whatever" ;
ifstream file( file_name ) ; assert(file) ;
vector<string> names, sequences ;
string line ;
// skip lines till we get one starting with DELIM
while( getline(file, line) )
if( !line.empty() && line[0]==DELIM ) break ;
names.push_back( line.substr(1) ) ;
string charseq ;
while( getline(file, line) )
{
if( !line.empty() && line[0] == DELIM )
{
sequences.push_back(charseq) ;
charseq.clear() ;
names.push_back( line.substr(1) ) ;
}
else
charseq += line + '\n' ;
}
sequences.push_back(charseq) ;
}
vijayan121
Posting Virtuoso
1,606 posts since Dec 2006
Reputation Points: 1,159
Solved Threads: 287