OK, I've tried running your code, and it only reads 1 line of text into a string, so a problem there...
I've not used stringstreams before so I'm not sure how they work but it looks like you have all sorts of variables doing things for no reason in the code.
Try using the code below in your main function instead to read a text file and see if it works.
1 2 3 4 5 6 7
|
ifstream infile;
string tmpstring,mystring;
infile.open ("y.txt");
while(getline(infile,tmpstring))
mystring+=tmpstring;
infile.close();
|
Then print out what has been read from the file with :
cout << mystring << endl;
If you can get that working to read 1 file, and understand what it's doing, the next thing would be to make mystring into an array of strings and place the text reading code into a function that you can call, passing in different filenames and an element of your string array.
See how you do, I can prompt you if you have trouble :-)