I tried to scan a text file ( contains decimal numbers) and save all the numbers into 1 array input1[50]. When I ran the code, the printout is always 1.0000 eventhough my text file have a bunch of numbers.
Could somebody point out where I did wrong? Thank you.
VOID CALLBACK TimerSend1(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
float input1[50];
float input;
int i = 0;
FILE * inputFile1;
inputFile1 = fopen("input1.txt","r");
while(feof(inputFile1)== 0)
{
input1[i] = fscanf(inputFile1,"%f",&input);
i++;
}
fclose(inputFile1);
char obuffer[MAX_PIPE_WRITE];
int len;
tSend1++;
if (tSend1 > 50) return;
len = sprintf_s(obuffer, MAX_PIPE_WRITE, "Bigger output message : <%f> ", input1[tSend1]);
printf("OUT1: %s\n", obuffer);
_write(fdpipe[WRITE], obuffer, len);