error while reading from a file

i basically have this: (with everything initialized and the proper headings)

in.open("inventory.txt");
while (!in.eof())
{
in >> itemID >> itemName >> pOrdered >> pInStore >> pSold >> manufPrice >> sellingPrice;
cout << itemID[4] << " " << pOrdered[1] << endl;
}


but for some reason i keep getting the error:

error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::ifstream' (or there is no acceptable conversion)

mind you in the compiler the only thing underlined red is the first set of ">>" after "in"

i'm sure its something really small that i just don't notice :/

thank you so much for the help! (and yes i know this is probably a very dumb thing to ask for help with so please take it easy on me lol)
It looks like itemID and pOrdered are arrays, but your putting the data into regular variables. If they are arrays, try this way. ( This is how I did mine, with different variables, of course ;) )

1
2
3
4
5
int count =0;
while ( in >> itemID[count] >> itemName[count] >> pOrdered[count] >> pInStore[count] >> pSold[count] >> manufPrice[count] >> sellingPrice[count])
{
count++;
}


The file being read, will close when the end of file is reached.
thank you so much! i knew it was something small! i totally get it now lol, i was comparing with older work that i did but i failed to realize i wasn't using arrays in that older work, thank you again!
My pleasure.
Topic archived. No new replies allowed.