M
MJK
Suppose I have the following function in my program:
void ExtractData(Ind *AM)
{
int i,j;
char str[255];
char c;
FILE *ext=fopen("test.out","r");
//suppose I have N line each with M digits (in here M=5) like: 1 2 2
1 3
for(i=0; i<N; ++i)
{
fscanf(ext,"%s",str); //This line read the whole 5 digits
//I want each of those five digits become an element of
"AM.S[j]" array as below:
for(j=0; j<M; ++j)
{
c=fgetc(ext);
AM.S[j]=int(c);
}
}
The above program is not working. Does any of you have any idea that
how I should write this part of my code?
Thanks,
MJK
void ExtractData(Ind *AM)
{
int i,j;
char str[255];
char c;
FILE *ext=fopen("test.out","r");
//suppose I have N line each with M digits (in here M=5) like: 1 2 2
1 3
for(i=0; i<N; ++i)
{
fscanf(ext,"%s",str); //This line read the whole 5 digits
//I want each of those five digits become an element of
"AM.S[j]" array as below:
for(j=0; j<M; ++j)
{
c=fgetc(ext);
AM.S[j]=int(c);
}
}
The above program is not working. Does any of you have any idea that
how I should write this part of my code?
Thanks,
MJK