It seems to stick on 11. It won't always let me input item number 12. The items i'm trying to enter are as follows. Code Description price ------ -------------- ------ 1000 Salt 0.56 1001 Rock Salt 0.89 1010 Peppercorns 1.59 1020 Plain Flour 1.11 1021 Wholemeal Flour 1.35 1022 Self Raising Flour 1.40 1030 Cane Sugar 1.20 1031 Icing Sugar 1.30 1032 Brown Sugar 1.35 1040 White Rice 1.10 1041 Brown Rice 1.15 1050 Yeast 4.50 1051 Dried Yeast 3.65 If I follow it in that order, I am not able to get past item number 11. If I enter random data however, (just tapping any old input) I don't have any problems. I've been chasing this bug for ages now...heh. If anyone gets a spare 20 mins, I would be greatfull if you could enter this data and see if you find the same bug. I have only tried this on a Windows machine, but I think if <conio.h> is swapped for <curses.h> (for getch()) and if <stdlib.h> is added for the system call (obviously the function needs swapping from 'cls' to 'clear') then everything should work OK. I have attached the file just in case there is a good samaritan :) (i'm also stuck on formating the print_bill() output) Thanks, Ged On Tuesday 13 January 2004 15:57, Trey Gruel wrote:
Thanks Trey / Charly / Jerry.
no prob
Anyway, I have a very strange bug in my program which I can't seem to iron out. When I add more stock via the number1 in the menu, everything is fine and I can build the stock up, however, if I then try and save this to file (via menu num 4) is doesn't always save my new stock, it stays as it was. e.g. I currently have 11 items in stock. If I go to add another item, it doesn't seem to save them.....I thought maybe it wasn't updating 'num_stock_items' but am unsure.
i had to make a couple small changes to get it to compile on the redhat 7.3 box i'm sitting at right now (get rid of conio.h/getch and no call to system(cls)), but i was unable to reproduce the problem.
i tried a couple runs of:
1) enter 2-3 items 2) display them 3) save to disk 4) quitting 5) restart the prog 6) load from disk 7) display them 8) goto 1
every time, all records were saved and loaded.
one comment on your file io: it's a good idea to close the file after you're done with it.
-- trey
-- -=SuSE Linux 9.0=-