C字符串处理函数的实现
本文来自: http://blog.pfan.cn/xiuandfang/24935.html
标签:C C ++ string String 数据结构
C字符串处理函数的实现
C字符串处理函数的实现(Linux)
#include <stddef.h>
char * ___strtok = NULL;
char * strcpy(char * dest,const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
char * strncpy(char * dest,const char *src,size_t count)
{
char *tmp = dest;
while (count-- && (*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
char * strcat(char * dest, const char * src)
{
char *tmp = dest;
while (*dest)
dest++;
while ((*dest++ = *src++) != '\0')
;
return tmp;
}
char * strncat(char *dest, const char *src, size_t count)
{
char *tmp = dest;
if (count) {
while (*dest)
相关文档:
◆经典C源程序100例:http://post.baidu.com/f?kz=8618367
◆时钟的驻留程序:http://post.baidu.com/f?kz=10822377
◆数据结构暨若干经典问题和算法:http://post.baidu.com/f?kz=10922856
◆LIUXUY 磁盘系统源程序:http://post.baidu.com/f?kz=12973347
◆RLE压缩:http://post.baidu.com/f?kz=12592570
◆快速排序 ......
结论:
char cmd[128];
...
int status = system(cmd);
printf("%d == system(\"%s\");\n", WEXITSTATUS(status), cmd); //打印返回值
网上搜到的答案与解释(1):
http://www.lslnet.com/linux/dosc1/38/linux-280268.htm
如何在unix c程序中得到system调用的返回值,请指教
对 system 的返回值 ......
Linux I2C核心、总线与设备驱动
注:
在linux2.6.32版本中有这样的代码与注释:
struct i2c_driver {
unsigned int class;
/* Notifies the driver that a new bus has appeared or is about to be
* removed. You should avoid using this if y ......
前言:
我们在这一节将要讨论linux下文件操作的各个函数.
1.文件的创建和读写
2.文件的各个属性
3.目录文件的操作
4.管道文件
--------------------------------------------------------------------------------
1。文件的创建和读写
......
设想中的C网络库ioframe is a simple base socket library using libevent.http://blog.csdn.net/Solstice/archive/2010/03/10/5364096.aspx
按照
的思想提交的一份代码。
设想中的 C++ 网络库线程安全,支持多核多线程在不增加复杂度的前提下可以支持 FreeBSD/Darwin,方便将来用 Mac 作为开发用机,但不为它做性能 ......