I'm trying to write a program that inserts a number line into a text file.
For some reason, fputc(int, FILE *) doesn't print out the int to stdout.

Code:
#include <stdio.h>

int main(int argc, char **argv)
{
        FILE *ifp = fopen(argv[1], "r");
        char c;

        int lineNumber = 0;
        while((c = getc(ifp)) != EOF)
        {
                fputc(c, stdout); //print char to screen
                if(c == '\n')
                {
                        fputc(lineNumber, stdout);
                        lineNumber++;
                }
        }
        printf("\nputc() ran %i times.\n\n", lineNumber);



        fclose(ifp);

        return 0;
}
input file
Code:
a
b
c
d
output
Code:
a
b
c
d

putc() ran 4 times.