
linux
北理孤狼
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
将一个十进制的数转换为二进制
void binary(unsigned char val) { printf("val:%d\n",val); unsigned char tmp = 0b10000000; printf("0b"); for(int i = 0; i < 8; i++) { if((val & tmp) != 0) { ...原创 2019-03-10 23:14:44 · 3071 阅读 · 0 评论 -
根据日期获得星期几
//根据日期获得星期几 unsigned char CaculateWeekDay(int y,int m, int d) { unsigned char buf; if(m==1||m==2) { m+=12; y--; } int iWeek=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7; s...转载 2019-03-11 19:07:37 · 371 阅读 · 0 评论 -
根据时间字符串提取数字
//根据时间字符串提取数字(例:“19:30:00”) hour_minute_t num(char *p) { hour_minute_t time; int num = 0; char q[20] = {0}; int i; int j = 0; for(i = 0; p[i] != '\0'; i++) { if(p[...原创 2019-03-11 19:10:21 · 681 阅读 · 0 评论 -
修改json对象的值并进行保存
//修改json对象的值并进行保存 static int parse_app_config(char *file) //file为config.json { char *cfg = read_config_file(file, NULL); static char *state_table[] = { "words=ni hao xiao le;thresh=0.3;ma...原创 2019-03-11 19:23:28 · 9888 阅读 · 0 评论 -
函数指针的经典使用
typedef enum { RK_UPGRADE_START, RK_UPGRADE_FINISHED, RK_UPGRADE_ERR, }RK_Upgrade_Status_t; typedef void(*RK_upgrade_callback)(void *user_data, RK_Upgrade_Status_t status); //函数指...原创 2019-05-02 15:15:03 · 349 阅读 · 0 评论 -
删除目录
#include <sys/types.h> #include <dirent.h> #include <fcntl.h> #include <stdio.h> #include <sys/stat.h> #include <strings.h> #include <stdlib.h> #include <s...转载 2019-05-08 19:55:49 · 638 阅读 · 0 评论