typedef char string20[21];
struct x{
string20 a;
string20 b;
string20 c;
};
How do I scan a text file and store their values on my structure? I can't think of an easy way on how to do this and btw I'm just learning I/O can't find any good tutorial on internet please help the file format is:
3
FCODE=random
FKEY=shit
FSRC=hi
how do i store "random" in a and etc... I know I should use strcpy ofcourse
Use
fgets
function to a single line.Use
strchr
orstrtok
to find exact data.copy into your structure
PS: don't forget validations. refer man pages