In-Class Practice


Write a program that reads accounting records from a file named input.dat and displays the information in tabular form on standard output.  Each record in the file contains the information for a single transaction and is delimited by a newline character. 

For example, a transaction record looks like

 1000;5625.00;Fees Billed

The first field contains the account number, the second field contains the transaction amount, and the third field contains a description of the transaction, which may include blank characters.  A semi-colon character delimits adjacent fields.

Complete the following code:

 // Accounting Records
 #include <stdio.h>

 int main(void)
         int rc;
         FILE* fp = NULL;

         if (fp != NULL) {

                 do {

                 } while (rc == 3);

         else {


         return 0;

   Printer Friendly Version of this Page print this page     Top  Go Back to the Top of this Page

  Designed by Chris Szalwinski   Copying From This Site   

Creative Commons License