Hi i have this text file, where the first column in a character the 2nd and the third one is an integer.. but I'm not able to read and print the values correctley.
So this the file am trying to read:
c 6
o 4 3
o 2 4
o 3 2
o 1 1
o 3 3
And here is the code :
#include <stdio.h>
#include <stdlib.h>
#define N 6
int main (int argc, char *argv[]) 
{
  int i;
  int M[N];
  int U[N];
  char c ;
  FILE* fichier = NULL;
  fichier = fopen("pb1.txt","r");
if(fichier!= NULL )
  { 
    while(!feof(fichier))   
    {
    fscanf(fichier, "%c %d %d", &c, &M[i], &U[i]); 
    printf("%c %d %d \n", c, M[i],U[i]);
    }
  }
}
This is what the output looks like
c 6 1472131424 
o 4 3 
 4 3 
o 2 4 
 2 4 
o 3 2 
 3 2 
o 1 1 
 1 1 
o 3 3 
 3 3 
I have no clue why it gives me this. thank you
 
     
    