The source code of the libc library on Windows is released ~~

Source: Internet
Author: User

1. A libc source codes on Windows by CC group (xichen2, xuchen); libc library under WindowsSource code, CC combination writing;

2. Because the C library contains a lot of content, it must still rely on the Windows C library and is gradually getting rid of the dependency. In the end, only the Windows API is called.

3. Open the project with vs2010;

4. refer to the followingCode:
Microsoft Visual Studio 10.0 installation directory:
Vc \ CRT \ SRC

5. The code is thread unsafe. View or:
Http://code.google.com/p/windows-libc/

Or search for Windows-libc in Google Code.

6. Sample Code:

Implement functions similar to the strtok function:

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. You are welcome to give your valuable comments and accept them modestly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.