I have the following code to read from a file
#include <queue>
#include <iostream>
#include <fstream>
#include <string>
main(int argc,char * argv[])
{
ifstream myFile(argv[1]);
queue<String> myQueue;
if(myFile.is_open())
{
while(...
}
}
I have an input file like this
1234 345
A 2 234
B 2 345
C 3 345
I want to do the equivalent of this in a read loop
myQueue.push("1234");
myQueue.push("345");
myQueue.push("A");
myQueue.push("2");
myQueue.push("234");
myQueue.push("B");
...
What is the best way to do this?
Thank!
source
share