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 :
Code:
struct Suppliertype
{
char *cName;
int iSuppId;
};
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:
Code:
void NewSupplier(void)
{
char sNewSupplier[50];
cout << "Enter the name of the new supplier: ";
cin >> sNewSupplier;
ofstream SuppFile("supplier.txt", ios::app);
SuppFile << sNewSupplier << "," << "/n";
}
i know i aint using the struct in this coz this is the problem - i dunno how to.
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