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.