Hey guys im new here and im working on some code that is meant to read in 2 files. The file opens just fine, everything gets allocated ok later on down the line, however, when I read in individual lines from the file thats when I run into issues.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main()
{   
char filename1[100];
    //Seting the file name for entery and seting the limit to 100
    //this one is for my matrix//
FILE* fp1;
    //FILE must be set as a pointer (FILE must also be capitalized)//
printf("Enter file name including file extention: \n");
    //This will pull in the name entered by the user//
scanf("%s", filename1);
    //scans in the name of the first file the file type needs to be 
included//  
fp1 = fopen(filename1, "r");
    //This will open the file as entered by the user//
if (fp1 == NULL)
{
    printf("\nError, file not found\n");
    exit(0);
}
int i;
int row1;
int col1;
fscanf(fp1, "%d,", &row1);
printf("%d \n ", row1);
fscanf(fp1, "%d,", &col1);  //WHY IS THIS SCANING WRONG!!!!//
printf("%d \n ", col1);
    //This will scan for the number of rows and columns in the matrix//
    //thats all for reading in the first file//
char filename2[100];
    //Seting the file name for entery and seting the limit to 100//
FILE* fp2;
    //FILE must be set as a pointer (FILE must also be capitalized)//
printf("Enter file name including file extention: \n");
    //This will pull in the name entered by the user//
scanf("%s", filename2);
    //Scans in the name of the first file//
fp2 = fopen(filename2, "r");
    //This will open the file as entered by the user//
if (fp2 == NULL)
{
    printf("\nError, file not found\n");
    exit(0);
}
return 0;
} 
This is what I get when i compile and run the full program. compiling
What should appear is a 5 and a 3 after loading in the data file.
the data is in the attached image but also here:
5
3
3.4,  6.5,  4.1
1.8,  3.3,  4.5
2.6,  7.4,  4.9
5.5,  6.1,  2.4
1.9,  2.7,  4.2
Everything else in my code works just fine with the exception of that.
 
     
     
    