hi there. New to the forums here so I apologise if this thread is in the wrong place
I've written a program that opens a text file and reads the data off it, and allows you to edit the information or add more stuff thats to it. When I go to save it, it asks for the filename to save it under, gives a little update on what you're saving, and then saves it.
So far it does all of that apart from save the file. When I go to save it, the size of the text file just keeps on increasing till my hard drive is full. It recon it must be looping the data that is sent to the text file somewhere but I don't know where.
Here's the part of my code that I use to save it, if I've not given enough of the code, just say I'll post more.
// SAVE STOCK DETAILS TO A TEXT FILE
void save_items( int numitems)
//char filename ;
cout << "Type the name of the data file... ";
cin >> filename;
cout << "this is the file name.." << filename << "\n";
int i = 1;
cout << "\n\t\tDefault filename is " << filename << " with " << numitems-1
<< " items\n";
cout << "\n\t\tSaving " << filename << ".......";
fprintf(out_file,"%7d %25s %25s %7d %7.2f \n", slist[i].stocknumber,
slist[i].description, slist[i].supplier, slist[i].quantity,
i = i++;
while (i <= numitems-1);
cout <<"\nSaved a total of" << i-1 << " items\n";