View Single Post
  #1 (permalink)  
Old 11-25-2007, 05:28 AM
peachyco peachyco is offline
Member
 
Join Date: Nov 2007
Posts: 6
peachyco is on a distinguished road
Reading a file for use
Hi, y'all!

I'm having some difficulty with storing information from my customer records. What happens after a transaction is the saving of the transaction in this format:

Code:
Customer No. Cashier Code yyyy/MM/dd HH.mm.ss (date and time stamped upon completion of transaction) <Item Code>:<Quantity Bought>:<Price Subtotal>:HH.mm.ss:<Flag if item was cancelled>
Now, at the start of the program, I must load this file to determine the last customer number assigned, so that the next customer will have the next customer no. in the sequence. My problem is how to read the file so that I can determine that last customer number. I was planning on using StreamTokenizer, but I'm unsure of how I'm gonna use it this time. Maybe read the customer numbers in an array/vector of integers and all others in an array/vector of Strings?

Here's a sample of the customer_records.dat file:

Code:
1 A0701 2007/11/01 11.32.10 1:2:10:2007/11/01 11.30.56: 3:1:5:2007/11/01 11.28.33: 9:3:15:2007/11/01 11.12.08:Cancelled 2 B0702 2007/11/01 15.00.02 5:5:25:2007/11/01 14.58.02:
Thanks in advance for any suggestion/comment/advice!
Reply With Quote
Sponsored Links