C
utopia54
城市街头突兀的一株荒草,昼看人世喧嚣,夜观琼宇繁星,时时叽叽渣渣,常常静静冥想!
展开
-
用 C, C++ 读取DICOM文件
用心阅读必能正确解析DICOM,外国佬的协议也很随性. 嫌烦的朋友直接下载代码就能运行原创 2022-10-19 11:12:31 · 2610 阅读 · 0 评论 -
uint32 转 float 示例
将32位无符号整数转为有符号的符点数float原创 2022-08-01 16:12:18 · 4233 阅读 · 0 评论 -
C,大小端字符转int, 字节交换
记录前人,方便自己查看, 运行结果://功能:对各个字(2B)的两个字节,进行位置交换操作。void swap_word(unsigned char *pArray, int nWords){ unsigned char *cc = pArray, c0; int i; for (i = 0; i < nWords; i ++)// Swap every two bytes { c0 = *cc; *cc = *(cc +原创 2021-10-20 18:35:21 · 299 阅读 · 0 评论 -
crc8高位在左低位在右,使用时请注意高低位顺序
小结前人的成果 :原码/* Return CRC-8 of the data, using x^8 + x^2 + x + 1 polynomial. A * table-based algorithm would be faster, but for only a few bytes it isn't * worth the code size. */uint8_t Crc8(const void* vptr, int len) { const uint8_t *data = (uint原创 2021-07-21 10:25:36 · 652 阅读 · 0 评论 -
linux c 获取指定目录下所有文件
示例代码, 直接可用, 码民各根据文件类型需求修改#include <stdio.h>#include <stdlib.h>#include <string.h>#include <dirent.h>#include <unistd.h>//char *p_path="/home/joshua/00Work/india";//readFileList(p_path);//文件类型如下://enum//{/原创 2021-07-20 11:12:23 · 717 阅读 · 0 评论 -
Linux C 获取系统控制台数据
小结: 有时候是需要从linux的控制台获取想要的数据,下面是总结前人加上亲自测试可用void get_md5sum(){char out_buf[1024]; 这两个BUF要一样大memset(out_buf, 0x00, sizeof(out_buf));//示例: 获取md5sum pic.jpg 较验文件码, e0bac 90024 4b89c 7d5c7 8a38b 35341 8bget_system_console_return_value("md5sum pic.jp原创 2021-07-20 11:04:41 · 661 阅读 · 0 评论 -
C_异或值_CRC
感谢牛人,历史总结//从$到*号所有char的异或int gps_xor_comparative_test(char * charGPS ){ //char a[]="$GPRMC,054041.000,A,1855.597600,N,07309.914880,E,0.00,143.39,250319,,,A*6F"; char * char_gps = charGPS;...原创 2019-12-10 11:09:36 · 289 阅读 · 0 评论 -
C 时区转换
只能精确到分void gpstime_to_india(int& year, int& month, int& day, int& hour,int &min){ hour += 5; min +=30; //india time zone if(min>=60){ hour+=1; min-=60; }...原创 2019-12-10 11:06:38 · 552 阅读 · 0 评论 -
linux c 获取终端光标的坐标
参考资料http://www.linuxquestions.org/questions/programming-9/get-cursor-position-in-c-947833/#include <unistd.h>#include <fcntl.h>#include <termios.h>#include <errno.h>#d...原创 2019-12-10 11:00:35 · 1332 阅读 · 0 评论 -
Linux下,获取或设置鼠标坐标
ubuntu,感谢牛人//----------------------------#include <sys/types.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include <stdarg.h>...原创 2019-12-10 10:56:16 · 1695 阅读 · 2 评论 -
C 鼠标操作:相对位移
感谢牛人,历史总结#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <linux/input.h>#include <fcntl.h>#include <sys/time.h>#include <sys/types.h>...原创 2019-12-10 10:54:20 · 360 阅读 · 0 评论