A_C++
文章平均质量分 70
Fairgofar
云笔记同步的~
展开
-
宏定义
1.使用#把宏参数变为一个字符串。#define STR(s) #sprintf(STR(xuyang))xuyang2.使用##把宏参数连接#define CONS(a,b) (int)(a##e##b)printf("%d \n", CONS(2,3));2e3 ->20003.宏定义求数组个数#define ARR_SIZE(a) ((原创 2017-11-23 21:01:38 · 137 阅读 · 0 评论 -
popen C函数获取linux命令的执行结果
#include#include#include#include#include#includeusing namespace std;string get_ttyUSBn(string name){ FILE *stream; char buf[1024]; memset(buf, '\0', sizeof(buf)); string strcmd= "sh ~/g原创 2017-12-20 19:07:57 · 1278 阅读 · 0 评论