Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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)
 


Ïà¹ØÎĵµ£º

Objective —C µÄµ¥Àýģʽ SingletonʵÏÖ


static
 DataManager 
*
sharedDataManager 
=
 nil;
+
 (DataManager 
*
) sharedManager
{
    @synchronized(self)
 {
        
if
 (sharedDataManager 
==
 nil)
 &nb ......

»ªÎªC/C++±ÊÊÔÌâ ¸½´ð°¸

1.staticÓÐʲôÓÃ;£¿£¨ÇëÖÁÉÙ˵Ã÷Á½ÖÖ£©
    1)ÔÚº¯ÊýÌ壬һ¸ö±»ÉùÃ÷Ϊ¾²Ì¬µÄ±äÁ¿ÔÚÕâÒ»º¯Êý±»µ÷Óùý³ÌÖÐά³ÖÆäÖµ²»±ä¡£
    2) ÔÚÄ£¿éÄÚ£¨µ«ÔÚº¯ÊýÌåÍ⣩£¬Ò»¸ö±»ÉùÃ÷Ϊ¾²Ì¬µÄ±äÁ¿¿ÉÒÔ±»Ä£¿éÄÚËùÓú¯Êý·ÃÎÊ£¬µ«²»Äܱ»Ä£¿éÍâÆäËüº¯Êý·ÃÎÊ¡£ËüÊÇÒ»¸ö±¾µØµÄÈ«¾Ö±äÁ¿¡£
    ......

ÈçºÎÔÚunixµÄc³ÌÐòÖеõ½system()µ÷Óõķµ»ØÖµ

½áÂÛ£º
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 µÄ·µ»ØÖµ ......

Cö¾ÙÀàÐ͵ÄʹÓ÷½·¨


1.  ö¾ÙµÄ¶¨Òåö¾ÙÀàÐͶ¨ÒåµÄÒ»°ãÐÎʽΪ£º
    enum ö¾ÙÃû{ ö¾ÙÖµ±í };
ÔÚö¾ÙÖµ±íÖÐÓ¦ÂÞÁгöËùÓпÉÓÃÖµ¡£ÕâЩֵҲ³ÆÎªÃ¶¾ÙÔªËØ¡£
ÀýÈ磺
   
¸Ãö¾ÙÃûΪweekday£¬Ã¶¾ÙÖµ¹²ÓÐ7¸ö£¬¼´Ò»ÖÜÖÐµÄÆßÌì¡£·²±»ËµÃ÷ΪweekdayÀàÐͱäÁ¿µÄȡֵֻÄÜÊÇÆßÌìÖеÄijһÌì¡£
2.  ö¾Ù±äÁ ......

cº¯Êýscanf(),printf()µÈ³£Óøñʽ×Ö·û´®

%d   ¶ÌÕûÐÎ,Ò»°ãÕ¼Á½¸ö×Ö½Ú
%u   ÎÞ·ûºÅ¶ÌÕûÐÎ
%ld  ³¤ÕûÐÎ,Ò»°ãÕ¼Ëĸö×Ö½Ú
%c   ×Ö·ûÐÍ
%s    ×Ö·û´®
Ö÷ÒªÓÃÔÚÊäÈëÊä³öº¯Êý£ºscanf(),printf()Àï
\a:·äÃù£¬ÏìÁå
\b:»ØÍË£ºÏòºóÍËÒ»¸ñ
\f:»»Ò³
\n:»»ÐУ¬¹â±êµ½ÏÂÐÐÐÐÊ×
\r:»Ø³µ£¬¹â±êµ½±¾ÐÐÐÐÊ×
\t:Ë®Æ½ÖÆ±í
\v:´¹Ö±ÖƱí ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ