Hi,
I have a file that look like this (for example)
Code:
1111 6666 0.12 1234
2222 7777 0.13 2345
3333 8888 0.14 3456
4444 9999 1.15 4567
5555 1010 0.16 5678
What I want is to put these value into four separate array. Here's a part of my program.
Code:
int main()
{
FILE * pFichier;
char line [BUFSIZ];
int dLimitInf;
int dLimitSup;
float fT;
int dK1;
int i = 10;
int j = 1;
int k = 1;
int l = 1;
int m = 1;
char sLimitInfStocke[7][5];
char sLimitSupStocke[8][5];
char sTStocke[5][5];
char sdK1Stocke[8][5];
while (fgets (line , BUFSIZ, pFichier) != NULL)
{
sscanf (line, "%d %d %f %d",&dLimitInf,&dLimitSup,&fT,&dK1);
sLimitInfStocke[7][j]= dLimitInf;
sLimitSupStocke[8][k]= dLimitSup;
sTStocke[5][l] = fT;
sdK1Stocke[8][m] = dK1;
j++; k++; l++; m++;
}
fclose (pFichier);
The part with the array is surely wrong. First because I have a warning message that tells me converting to char from float. Also, I've tried to see if my arrays were alright, but I'm not able to print something that make sense. So I would appreciate if someone could give me an other way to do it (since I'm pretty sure this thing doesn't work) and well, if it's right how do I print these values from the array.
Thanks