Extract info from file
I have a file that contains emails. The format is
< email: sender1@hotmail.com >
1111 开发者_如何转开发2222 3333 aaaa
</email>
< email: sender2@gov.gr>
aaabbbbb cccccc
</email>
and I want to save in variables some info (senders , message and number of emails)
my code is like that
FILE *fp;
char line[150];
fp= fopen("a.txt", "r");
if (fp==NULL)
error ("opening file");
else{
while (!feof(fp))
{
fscanf(fp, "%s", line);
printf("%s\n", line);
// does C support regular expressions ???
}
}
Regular Expression Matching in C.
精彩评论