开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜