I want to parse a text file in a C program. The file contains data that is likely to be:
block1=
{
a="some text with space and double quota"
b=random text
c=random text
d=random text
e=random text
f="number"
g=number
}
block2=
{
a="some text with space and double quota"
b=random text
c=random text
d=random text
e=random text
f="number"
g=number
}
There may be n number of blocks, I want to create list of elements (“a” elements of each block) , for that what should I do? Is there any parsing API for text file in C?
For fixed format code, fread can be used as above or you have to use fscanf with some string functions.