Dec 18, 2012 at 11:22am
Hello
I need help with my c++ code
I wrote the statement that makes it read from a file
which was
file>>cust.numcust>>cust.arrtime;
"As file is the name of the file"
but he never reads from the file
and while debugging and after executing the the statement it sets the cust.numcust as zero
what can I do??
Thanks in advance
Dec 18, 2012 at 12:04pm
ifstream infile;
infile.open ("input.txt");
infile>>cust.numcust>>cust.arrivetime>>cust.svctime>>cust.per;
What's wrong with the statements above??
Dec 18, 2012 at 3:00pm
Although the statements above have no syntax errors, the program could not run!!!!
I don't know where is the problem
Dec 18, 2012 at 3:34pm
Did you check if the file was open, as coder777 suggested?
Dec 18, 2012 at 5:16pm
You should post the whole block of code and not just one line.
Dec 19, 2012 at 8:04am
ok I'll try to post the whole block of code
It's very long
Dec 19, 2012 at 11:54pm
Thanks to you all :)
Finally the file was opened
But I still have a question
the file contains 4 lines of inputs
how can I make it read from the file line b line
till now it reads only the first line
how to make it read the next line each iteration in the loop???