if(readFile.is_open() && readFile.good()){
cout<<"File exists and ready to be read!"<<endl;
readFile>>noskipws;
cout<<endl;
readFile.ignore(10,'\n');//ignore first line of file
//read in to struct variable info from file
for(int i=0;i<numberRec;i++){//size of array of struct
readFile.getline(info[i].name,100);
readFile.getline(info[i].about,100);
readFile.getline(fileread,100);
info[i].items=atoi(fileread);
readFile.getline(fileread,100);
info[i].price_per_item=atoi(fileread);
readFile.getline(info[i].details.name,100);
readFile.getline(info[i].details.address,100);
readFile.getline(info[i].details.phone,100);
}
readFile.clear();
readFile.ignore();
readFile.close();
}
Welcome to Karim & Co. Chocolate Store
do you wish to create a file for chocolates?
N
Enter file to open: choco.txt
Please enter number of records to read: 2
File exists and ready to be read!
Please choose from main menu
1.Sales Transaction 2.Restock Chocolate
3.Change Supplier Info 4.Display Chocolate Info
5.Quit
Choose from main menu?:
4
Type 1
2
ش
0
0
0
ύ�
Type 2
0
0