It waits into the infinite loop while(feof(pFile) != 1). The function fscanf, and fgets, increments the pFile for you. You don't need to do nothing, but, if you want to read more than one line, you need to put that sentence into any loop.
Put fscanf into while(feof(pFile)!=1) and execute then. You need to close the file (is a good practice ever that your program works). Why is \n there?, \n is not sense there..., fscanf reads a line for you.
And, %d, is for "integers", not for buffers. You need to change it to "%s", or "%c" to characters. Buf is a char, not a string. Can you post a the file that you want to read? (is one number for each line?)
#include <stdio.h>
#include <sys/io.h>
///////////////////////////////////
//Novamoon ParProg Utility //
//Written by Moondeck //
///////////////////////////////////
//WTFPL License //
///////////////////////////////////
void main()
{
FILE * pFile;
const char fmode[2] = "r";
char strpatch[40];
char buf;
char character[3];
int chnum = 3;
int i = 1;
printf("Welcome to Novamoon ParProg Programming utility v0.1a \n");
printf("Please specify a .mprog file: ");
scanf("%s",strpatch);
printf("\nTrying to flash file at:\n");
printf(strpatch,"\n");
pFile = fopen (strpatch , "r");
if (pFile == NULL)
{
printf("\nError opening file, press Ctrl+C to terminate\n");
}
else
{
while(feof(pFile) != 1)
{
printf("\nLine %d : %c \n",i,buf);
fscanf(pFile, "%c", &buf); // You need to fscanf every iterate in the loop. And, why \n here?
i++;
}
fclose(pFile); // !
printf("\nEnd of File, Programming success!\n");
printf("Press Ctrl+C to terminate");
while(1);
}
}
Regards,
Marcel