I have a C code that opens and reads a text file with numbers then computes the area of a rectangle using those numbers. My Code is:
#include <stdio.h>
int main()
{
FILE *ifile;
float length, width;
float maxarea = 0, maxlen, maxwidth;
ifile = fopen("rectangles.txt", "r");
while (feof(ifile) <= 0)
{
fscanf(ifile, "%f %f", &length, &width);
if (length * width > maxarea)
{
maxarea = length * width;
maxlen = length;
maxwidth = width;
}
}
printf("Maximum area is %f for rectangle with length %f and width %f",
maxarea, maxlen, maxwidth);
fclose(ifile);
return(0);
}
When I debug it this shows up:
When I retry it it shows this error:
With the same code when I run it on a Linux Terminal it works and gives the right output. (recLarge is the executable file)
How can I get the same output on Visual Studio 2017?