Search:

Type: Posts; User: qny

Search: Search took 0.01 seconds.

  1. Replies
    13
    Views
    1,908

    In eofnormalize(), a call to a file positioning...

    In eofnormalize(), a call to a file positioning function is needed between input and output.
    I no longer can edit my post, but I'd change the function to:


    #include <stdio.h>

    int...
  2. Replies
    13
    Views
    1,908

    My code works for me: #include ...

    My code works for me:

    #include <stdio.h>
    #include <stdlib.h>

    int eofnormalize(const char *fname) {
    FILE *h;
    int ch;

    if ((h = fopen(fname, "a+b")) == NULL) return 1;
  3. Replies
    13
    Views
    1,908

    Is this the expected outcome?

    Is this the expected outcome?
  4. Replies
    13
    Views
    1,908

    You opened the FILE for append mode, but then try...

    You opened the FILE for append mode, but then try to read from it ... this is a big no no: don't do that!
    Open the file for reading / appending in binary mode like I suggested

    if (...
  5. Replies
    13
    Views
    1,908

    Untested: FILE *inSalesPtr; //open the...

    Untested:


    FILE *inSalesPtr;

    //open the file for binary read/append
    if ((inSalesPtr = fopen("sales.txt", "a+b")) == NULL) exit(1); /* exit on error */

    // set the file position to the very...
Results 1 to 5 of 5