title: Reading and printing to/from a file
body: <p>I am taking a course on C and have been faced with the following task: 1. Load XCode and start a new C project. If you wish, remove
  any extraneous code from the project so that you are left
  with only what’s necessary to run the main function in your
  project.
  2. Prompt the user to enter two values-- the first a char
  value of ‘D’ or ‘C’. The second value should be a floating
  point value representing an amount of money.
  3. As each value is entered record it to a text file that
  saves it in the following format:
  D, 250\n
  C, 500\n
  4. Test your program and examine the text file that it creates
  to insure that it is in the required format.
  5. Write a second program that assumes a starting balance of
  $1,000.00 and outputs a completed ledger and final balance
  for the account, adding or subtracting each entry from the
  text file you previously created. Entries marked as a ‘C’
  should be added to the account and entries marked as a ‘D’
  should be debited (subtracted).</p>
  
  <p>I have already created the file and am now onto step 5, I believe i know how to obtain the first character from the file to check if it is a 'c' or 'd', but after that i am not sure how to obtain the numerical value from the same line. How do I do this? This is my code so far(I am unsure what to put in the if/else if statements): </p>
  
  <pre><code>   FILE *pFile = fopen("Users/Justin/Desktop/Ledger.txt", "r");
      float startingBalance = 1000.00;
      char action;
  
      if(pFile != NULL)
      {
          while(!(feof(pFile)))
          {
              fgets(action, 1, pFile);
  
              if(action == 'D' || action == 'd')
              {
  
              }
              else if(action == 'C' || action == 'c')
                  {
  
                  }
              else
                  printf("IO Error: Problem with file");
  
          }
      }
  
  
  
      return 0;
  }
  </code></pre>