EC200模块 CMTI消息解析

博文EC200模块 设置新短信通知输出通道介绍了如何设置+CMTI指令。
使用sscanf和简化版的正则表达式,可以解析出存储位置(ME、SM)和所在的索引index。

#include <stdio.h>
#include <stdlib.h>

int main()
{
    
    
    char ss[]="+CMTI: \"ME\",10";
    char device[100];
    int index=0;

    sscanf(ss,"+CMTI: \"%[A-Z]\",%d",device,&index);
    printf("%s\n",device);
    printf("%d\n",index);

    printf("Hello world!\n");
    return 0;
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_27508477/article/details/108393720
今日推荐