windows平台下面的libc库源代码新鲜出炉~~

1、a libc source codes on windows by cc group(xichen2, xuchen); windows平台下面的libc库源代码, cc组合编写;


2、因为C库的内容很多,目前必须依然依赖windows的C库,正在逐步摆脱依赖关系,最终实现只调用windows API.

3、工程使用VS2010打开;

4、参考如下代码:
Microsoft Visual Studio 10.0安装目录下:
VC\crt\src

5、代码是线程不安全的;查看或者下载地址:
http://code.google.com/p/windows-libc/

或者在google code中搜索 windows-libc


6、代码示例:

实现类似strtok函数功能的函数:

char * __cdecl cc_strtok( char *str, const char *delim ) { static char *last; char *strCp = str; // backup the str head pointer int hasFoundToken = 0; if(!str) { strCp = str = last; // if str is NULL, update the str head pointer } while(*str) { if(cc_strchr(delim, *str)) // if found the delims in the str { ++str; if(!hasFoundToken) { ++strCp; } else // if hasFoundToken { if(strCp != str) break; } continue; } hasFoundToken = 1; ++str; } if(!*str) return NULL; *(str - 1) = '\0'; // end the token by null character last = str; // save the last pointer return strCp; }


7、欢迎大家提出宝贵的意见,虚心接受。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值