前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >L005Linux和androidNDK之c语言中的正则表达式

L005Linux和androidNDK之c语言中的正则表达式

作者头像
上善若水.夏
发布2018-09-28 10:53:44
7240
发布2018-09-28 10:53:44
举报
文章被收录于专栏:上善若水上善若水

这一块很好玩,熟悉的话,编程起来也很有效率~ 待补充~~

测试代码

获取字符串中的指定信息

代码语言:javascript
复制
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <linux/if.h>
#include <linux/sockios.h>
#include <sys/statfs.h>
#include <arpa/inet.h>

//获取http应答帧的返回值
int test()
{
    char *s1="HTTP/1.1 200 OK\r\n";
    char *ss="HTTP/1.1 505 hdhdh\r\n";
    char *str=ss;
    int a=0;

    sscanf(str,"%*[^ ]%d%*[^1]",&a);

    printf("a=%d\n",a);
}

int main(int argc,char **argv)
{
    test();
}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016.07.18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 测试代码
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档