Question in fstream...

i wanna to declare a function to write a sequnce of strings in fstream,, i wrote a function like that:



static void InFileWrite(string mysr){
ofstream myfil;
myfil.open("InputFile.txt");
myfil<< mysr<<endl;
myfil.close();
}


but when i use it ,it does store the last string entered only ....

thnx in advance :):)
Change myfil.open("InputFile.txt");
to
myfil.open("InputFile.txt", ios::app);
Thankkkkkkkkkkkkkkkkkkkkkkkkkks alotttttttttttttttttt

...it worksss.......:):)
Topic archived. No new replies allowed.