good evening friends,
i am working on files in c++. i created two program working good separately but don't work when merged.
1st program is to create a file "test.txt" which holds name dynamically created. code is below...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <fstream>
usingnamespace std;
int main()
{
fstream afile;
afile.open("test.txt", ios::out);
int i = 1;
while(i <= 10)
{
afile << "file" << i << ".txt ";
i++;
}
return 0;
}
2nd program is to show names which were created in "test.txt" file. code below...
now both work good when i run first program & then second program but when i tried to merge code of both programs into single program it work only half ways means it only create file but don't display its content. code for of merging after merging...
now the question is, is it possible to create a file and get its content in use in the same program. or i it is to THREADING, i guess. if it is not about thread then how will we do this in a single program attach code.
i think my question is little bit clear. *can you also tell me little bit about threads or its tutorials about how to use it in c++(if possible attach link of good tutorials of thread).*
thanks in advanse...