windows平台下面的libc庫原始碼新鮮出爐~~

來源:互聯網
上載者:User

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、歡迎大家提出寶貴的意見,虛心接受。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.