convert a fasta file into a pair with T1 and T2 being strings

Should be a simple problem.
I have a fasta file with n rows, and now I need to put it in a pair with the first row being T1 and T2 should be the second until the n-th row and should be a string wihtout returns or breaks of any kind.

what I have right now is:


ifstream inFile;
inFile.open("myFasta.fasta");

string x, y;
inFile >> x >> y;

pair <string,string> fasta_file;
fasta_file = make_pair(x,y);

but that only works for the first and second line...
Last edited on
I fail to see how that may work for the second line, as you are just reading the first one.

1
2
3
while(inFile>>x>>y){
   //...
}
that would read the whole file, you may proccess it line-by-line or store it in a std::vector for later use.
Topic archived. No new replies allowed.