-
looksy
how to append this info
instead of overwriting existing file
#include<iostream.h>
#include<fstream.h>
void main()
{
char first_name[25];
char last_name[25];
char subject[15];
char sector;
//now setup a file stream
//firstly a name and input file
ifstream infile;
//now associate it with a file
infile.open("B:\\persons.txt");
infile>>first_name;
infile>>last_name;
infile>>subject;
infile>>sector;
//now read it!!!!
infile.close();
//display
cout<<endl<<"first_name:-"<<first_name;
cout<<endl<<"last_name:-"<<last_name;
cout<<endl<<"subject:-"<<subject;
cout<<endl<<"sector:-"<<sector;
cout<<endl<<endl;
}//end program
-
>>infile.open("B:\\persons.txt");
outfile.open("B:\\persons.txt" ,ios::app); //who uses b anymore?
i think you might have to include <iomanip.h>
I know this works for output. You do want this to be put "out" in the file right?
-
B:\\ is my internal ZIP drive
(college computer technologically backwards country[Scotland])