In this minor assignment, you will write a complete C program that will accept two command-line arguments for the names of an account file and a transaction file. Your program will as mutually exclusive operations (1) read the data from the account file into a dynamically allocated list, (2) read the data from the transaction file and update the inmemory list of accounts, and (3) write the updated data to the account file in the same format as the original account file. This means, for example, that you do not write the updated data to the account file until after all the transactions have been read and updated in memory.
The account file will contain a variable number of user accounts with three fields on each line, one account per line: (1) account number as an integral value fixed at 8 characters in length, (2) account name supporting at most 20-characters containing no spaces, and (3) account balance with a leading '$' character formatted in dollars and cents. Note that if the account balance is negative, the leading '$' will be preceded by a negative sign.
The transaction file will contain a variable number of transactions with two fields, one transaction per line: (1) either account number or account name (not both) with the account number and account name as described in the account file, and (2) a signed, real number representing a monetary amount, formatted to two decimal places, but no $' character.
Some assumptions and general rules
Sample Output
$ more acctFile
01014791 Johnson-Smith $1389.01
01020811 Thompson $653.36
01028352 Smith $7180.18
01048741 Jones $6926.65
01058388 Williams $1284.38
01078192 McReynolds $38.23
01183485 Webber $1983.87
02817471 Martinez $4028.22
03184971 Thomas $3164.26
$ more xactFile
01020811 -25.95
Smith 231.12
01028352 -19.99
Jones 132.82
01014791 -83.45
McReynolds -5.24
Martinez 481.83
01045737 37.90
01058388 106.57
Webber 14.63
Jonas -138.52
Johnson-Smith -89.42
01078192 -40.00
$ ./a.out
usage: ./a.out < account file> < transact file>
$ ./a.out acct
usage: ./a.out < account file> < transact file>
$ ./a.out acct xactFile
error: unable to open file acct
$ ./a.out acctFile xact File
error: unknown account number: 01045737
error: unknown account number: Jonas
$ more acctFile 01014791
Johnson-Smith $1216.14 01020811
Thompson $627.41 01028352
Smith $7391.31 01048741
Jones $7059.47 01058388
Williams $1390.95 01078192
McReynolds -$7.01 01183485
Webber $1998.50 02817471
Martinez $4510.05 03184971
Thomas $3164.26
$ more acctFile2
01078192 McReynolds -$52.25
$ more xactFile2 McReynolds -16.24
$ ./a.out acctFile2 xactFile2
$ more acctFile2
01078192 McReynolds