#include
#include
#include
#include
#include
FILE *f; /* global FILE defined for Ctrl+C Pressed */
static void sig_int(int num)
{
fprintf(stderr, "get signal from -- Ctrl+C Pressed");
textcolor(15);
_pclose(f);
}
int main(int argc, char **argv)
{
int i=0, j=0;
char buf[1024*2] ={0};
signal(SIGINT, sig_int); /* register signal */
if (argc==2){
for (i=0; i<99; i++){
textcolor(i);
printf("%d -> color test\n", i);
}
textcolor(15);
return 1;
}
f = _popen("adb logcat -v time", "r");
if (f == NULL){
fprintf(stderr, "popen() fail.");
return 1;
}
while(fgets(buf, sizeof(buf), f)>0)
{
if (strstr(buf, "D/"))
textcolor(9);
else if (strstr(buf, "W/"))
textcolor(14);
else if (strstr(buf, "I/"))
textcolor(11);
else if (strstr(buf, "E/"))
textcolor(12);
else if (strstr(buf, "V/"))
textcolor(13);
else
textcolor(8);
fprintf(stdout, "%s", buf);
}
_pclose(f);
return 0;
}
共1条
1/1 1 跳转至页
adb程序彩色输出

copy
共1条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
Buck电路工作在CCM模式下电感电流的计算公式是什么?被打赏5分 | |
buck电路工作原理被打赏5分 | |
基于MSPM0L1306的MODBUS-RTU协议通讯实验被打赏100分 | |
每周了解几个硬件知识+485硬件知识分享被打赏10分 | |
【换取手持示波器】树莓派PICOW网页烟花被打赏18分 | |
【换取手持示波器】树莓派PICO逻辑分析仪被打赏16分 | |
【分享评测,赢取加热台】教你五分钟本地部署蒸馏版本的DeepSeekR1-7B被打赏12分 | |
【换取手持示波器】蓝牙音箱更换电池被打赏8分 | |
【换取手持示波器】鼠标更换微动开关被打赏10分 | |
【我要开发板】4.传感器移植被打赏50分 |