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.
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 :-)
Thanks guys for the comments. There is another idea by renaming the text files as data_0.txt, data_1.txt, and so no.
The idea is to read each file by changing the file name and that is by concatenate the part of file name which is data_ with the integers 0,1,2...etc. within loop.
the code is :
but i got this error: cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const char*'for argument `1' to `FILE* fopen(const char*, const char*)'
Thank you Galik, it works now but the funny thing which i cannot understand, is the code cannot open and read the text file. The output is:Could not open the file