Thick n00b needs help with File i/o and structs
OK folks im being as dense as a very dense thing here. Ive searched for tutorials etc and i cant seem to figure it out in the way i want to use it.
I want a struct to hold data on a supplier, namely and ID for the supplier and a supplier name.
im currently using :
I then want the user to enter the new data and append this data to a text file (supplier.txt).
im currently trying it like this:
i know i aint using the struct in this coz this is the problem - i dunno how to.
cout << "Enter the name of the new supplier: ";
cin >> sNewSupplier;
ofstream SuppFile("supplier.txt", ios::app);
SuppFile << sNewSupplier << "," << "/n";
After ive appended the file i want to have a separate function to read the text file and display the list of suppliers on the screen.
This is for part of my Uni degree (only 1st year tho) so i aint gonna be nicking peeps code for commercial use - i just want to know how to do this.
Thanks in advance :)