i want to read parameters from a file. but the program reads all parameters as if they are zero.any help?
here is the code
typedef unsigned long int WORD;
unsigned long int parameters[2];
WORD pt1[2];
void readConfig()
{ char a[3];
FILE *p;
p = fopen("config.data", "r");
if (p) //we are reading
{
while(!feof(p))
{
fscanf(p, "%s %lu", a, ¶meters[0]);
parameters[0]=pt1[0];
fscanf(p, "%s %lu", a, ¶meters[1]);
parameters[1]=pt1[1];
}
}
else //we have an error, could not read
{
printf("Config file could not be read.\n"); //give warning
}
fclose(p);
}
void main()
{ WORD i, j, k, pt2[2], ct[2] = {0,0};
unsigned char key[b];
readConfig();
printf("\n plain text %lu %lu \n", parameters[0], parameters[1]);
the program print the parameters as 0.
thanks in advance.