syntax error : 'bad suffix on number'
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
const int Max=100;
struct Item
{
string ID;
int sold;
int rem;
};
void read(Item Itemlist[], int length, string filename)
{
std::ifstream infile("filename.txt");
std::ofstream outfile("filename.txt");
infile.open("filename");
for(int i=0; i<length; i++)
{
infile >> Itemlist[i].ID;
cin.ignore(100, ' ');
infile >> Itemlist[i].sold;
cin.ignore(100, ' ');
infile >> Itemlist[i].rem;
}
return;
}
I get this error for every line of code in my text file. i figure the problem must be here.
This is a piece of what i have in main
Code:
#include "C:\Users\User\Desktop/inventory.txt"
#include "myfile.h"
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
int main()
{
struct Item myArray[Max];
read(myArray, Max, "inventory.txt");
..etc