C tools
darren-wang
这个作者很懒,什么都没留下…
展开
-
C99 实现类似 C++ string.find
去除字符串两端的特殊字符。string库里么找到合适函数。 #include #include void string_find(char *result, char *source, int length, char k){ int i=0; int j=1; int p =0; while (*(source+1) == k) {原创 2013-12-18 14:17:53 · 638 阅读 · 0 评论 -
snprintf VS itoa
use snprintf, it's the new more portable itoa. itoa is not part of standard C, nor is it part of standard C++; but, a lot of compilers and associated libraries support it. An example of a spri转载 2014-01-10 20:40:37 · 691 阅读 · 0 评论 -
pthread 子线程全局变量访问
方法1: 全局变量声明 volatile struct MY_STRUCT *Data; void* my_thread(void* param); // 子线程内 void* my_thread(void* param){ MY_STRUCT p =(MY_STRUCT*) Data; /* */ } 方法2: 声明 struct原创 2014-01-15 17:00:07 · 834 阅读 · 0 评论 -
C 如何将标准输出重定向到文件
stdin,stdout,stderr是常量,无法直接赋值? FILE *fp; stdin = fp gcc x86编译无警告,运行正常。 android gcc(ARM-48) 编译报错 error: lvalue required as left operand of assignment stdin = fp; ^ 解决方转载 2013-12-19 10:23:58 · 1362 阅读 · 0 评论 -
C Program to sleep for millisecond in windows, linux
Probably a wrapper using platform specific #defines will do: #if defined(WIN32) #include #elif defined(__UNIX__) #include #else #endif ... int millisleep(unsigned ms) { #if defined(WIN32) S转载 2014-03-24 11:52:07 · 435 阅读 · 0 评论 -
others
pthread https://computing.llnl.gov/tutorials/pthreads/ http://www.cs.kent.edu/~ruttan/sysprog/lectures/multi-thread/multi-thread.html#preface Rs232 http://www.cmrr.umn.edu/~strupp/serial.h转载 2014-03-15 23:41:28 · 432 阅读 · 0 评论