hi,
i have a file which contains
dfca2345f1278aba11110012567ade21
i also have a structure
i need to read from file and print the values of struct in decimal form (i.e s.a=3754566469 , similarly b,c,d,e)
so i ve come up with only this, i am not getting how to populate struct and store something like this(siz.a[]={'d','f','c','a','2','3','4','5','\0'} and print dec value of s.a
i am using snprintf and also strtoul but not getting
#include<stdio.h>
struct s
{
int a;
int b;
short c;
int d;
short e
}siz;
int main()
{
FILE *fp;
char line[128];
char buf[100];
fp=fopen("a.txt","r");
if(fp!=NULL)
{
while(fgets(line,sizeof(line),file)!=NULL)
{
fputs(line,stdout);
}
fclose(fp);
}
else
{
perror(fp);
}
return 0;
}