Hi,
I am trying to read a file and store its content into 2 seperate arrays (one char** the other a int array) - the content of the int array is modified and then rewritten to the file (overwritting file).
sample text file:
aaaa 304
bbbb 120
ccccc 441
dddd 5
eeee 61
Code:
#include <stdio.h>
void main()
{
FILE *pFile;
int x=0;
int num[5][100];
char arr[5][100];
int buff[100];
pFile = fopen ("log.txt", "r");
for (x=0; x<5; x++)
{
fscanf (pFile, arr[x]);
fscanf (pFile, num[x]);
}
for (x=0; x<5; x++)
{
printf ("Arr: %s", arr[x]);
printf ("Num: %d\n", num[x]);
}
}
It seems that i am reading garbage into arrays...