I have problem with file. The problem is I have to compare two file 1)master file and 2)transaction file. both have accno, amount,id and code(d-deposit,w-withdraw). the accno is in char[10] ,amount double, id integer and code character[1].

my problem is how to compare accno from master file with accno from transaction file,because both acc no is character and if acc no(master file) equal acc no(transaction file) i have to copy the accno(master file) and the rest(amount,id) to new master file.all file is in sequential file.

can anyone help me
tq :rolleyes:


This should be pretty straightforward.

First, you need to create two data structures in memory. They will be the same structures, but one will be the master file data, and the other will be the transaction file.

Couple things for you to think about:
* Array or linked list?
* Look up the string compare function to see how to compare account numbers
* How will you handle bad data in the transaction file?
* When the program is done, write out the memory to a flat file.

Go ahead and code this out. If you need more help, please show us some psuedo code, and let us help. We cannot go too much further in assistance, as it would violate DaniWeb homework policy.