开发者

Extract info from file

开发者 https://www.devze.com 2023-01-25 20:49 出处:网络
I have a file that contains emails. The format is < email: sender1@hotmail.com > 1111 开发者_如何转开发2222 3333 aaaa

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

精彩评论

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

关注公众号