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

´´½¨ÖîÈç "c:\a\b\c\d\yeah.log"Öеĸ÷¼¶Îļþ¼Ð

×î½üά»¤Logger¹²Ïí¿âµÄʱºòÐÂÔöÁ˸üÈËÐÔ»¯µÄ×Ô¶¯´´½¨¸÷¼¶Ä¿Â¼µÄ¹¦ÄÜ£¬ÏÂÃæÊÇÎÒʵÏÖ´´½¨ÖîÈç "c:\a\b\c\d\yeah.log"Öеĸ÷¼¶Îļþ¼ÐµÄ¹ý³Ì£¬Çë´ó¼ÒÖ¸½Ì£¡
BOOL CreateDirectoryInPathW(const wchar_t *sLogPath)
{
 static BOOL bRet = 0;
 CString csFullDir(_T(""));//ԭʼȫ·¾¶
 int nLen = 0;//ԭʼȫ·¾¶³¤¶È
 int nIdx = 0;//µ±Ç°“\\”µÄλÖÃ
 int nLeft = 0;
 CString csLastDir(_T(""));
 if (wcslen(sLogPath) > MAX_PATH)
 {
  OutputDebugString(_T("Failed to create directory.This limit is related to how the CreateDirectory function parses paths\r\n"));
  return 0;
 }
 csFullDir.Format(_T("%s"), sLogPath);
 nLen = csFullDir.GetLength();
 if (-1 == csFullDir.Find(_T('\\'), 0))
 {//²»Óô´½¨Îļþ¼Ð
  return 1;
 }else if (2 == nIdx)
 {//¸ùĿ¼ºöÂÔ
  nLeft = nIdx+1;
 }
 while (1)
 {
  nIdx = csFullDir.Find(_T('\\'), nLeft);
  if (-1 == nIdx)
  {
   break;
  }
  nIdx = csFullDir.Right(nLen-nLeft).Find(_T('\\'), 0);
  nLeft += nIdx+1;
  csLastDir = csFullDir.Left(nLeft);
  bRet = CreateDirectory(csLastDir, NULL);
 }
 return bRet;
}


Ïà¹ØÎĵµ£º

c/c++ÖÐÄÚ´æÇøÓò»®·Ö´ó×ܽá

Ò». ÔÚcÖзÖΪÕ⼸¸ö´æ´¢Çø
1.Õ» - ÓɱàÒëÆ÷×Ô¶¯·ÖÅäÊÍ·Å
2.¶Ñ - Ò»°ãÓɳÌÐòÔ±·ÖÅäÊÍ·Å£¬Èô³ÌÐòÔ±²»ÊÍ·Å£¬³ÌÐò½áÊøʱ¿ÉÄÜÓÉOS»ØÊÕ
3.È«¾ÖÇø£¨¾²Ì¬Çø£©£¬È«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿µÄ´æ´¢ÊÇ·ÅÔÚÒ»¿éµÄ£¬³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿ÔÚÒ»¿éÇøÓò£¬Î´³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍδ³õʼ»¯µÄ¾²Ì¬±äÁ¿ÔÚÏàÁÚµÄÁíÒ»¿éÇøÓò¡£- ³ÌÐò½áÊøÊÍ·Å
4.ÁíÍ ......

C/C++ÓïÑÔ±à³ÌÐÞÑø£¨×ª£©

±à³ÌÐÞÑø £¨×÷Õߣº³Â𩣩
————
ת×Ô:http://blog.chinaunix.net/u1/49717/showart.php?id=2138481 
ʲôÊǺõijÌÐòÔ±£¿ÊDz»ÊǶ®µÃºÜ¶à¼¼Êõϸ½Ú£¿»¹ÊǶ®µ×²ã±à³Ì£¿»¹ÊDZà³ÌËٶȱȽϿ죿
ÎÒ¾õµÃ¶¼²»ÊÇ¡£¶ÔÓÚһЩ¼¼Êõϸ½ÚÀ´ËµºÍµ×²ãµÄ¼¼Êõ£¬Ö»Òª¿´°ïÖú£¬²é×ÊÁϾÍÄÜÕÒµ½£¬¶Ô
ÓÚËÙ¶È¿ì£¬Ö ......

c/c++ °æ¡°¾­µä¡±ÎÊÌâ½â´ð


·¢ÌùÇ°ÇëÏȶÁ£ºc/c++ °æ“¾­µä”ÎÊÌâ½â´ð
C/C++Ò»Ö±¶¼ÊǵØÇòÉÏʹÓÃ×î¹ã·ºµÄ±à³ÌÓïÑÔ£¬¶øÎÒÃǵÄC/C++°æ×ÔÈ»ÈËÆøÒ²²»²î£¬µ«ÊÇÒ»Ö±¶¼ÓÐһЩºÝ³õ¼¶µÄÎÊÌâÌáÁËÓÖÌᣬ²¢²»ÊÇ˵ÕâЩÎÊÌâÈçºÎÈçºÎµÄ²»ºÃ£¬»¹ÊÇÈçºÎÈçºÎµÄÈõÖÇ£¬ÕâЩÎÊÌâÒ»Ö±¶¼ÊÇÐÂÊÖѧϰµÄ»ù´¡£¬ÊDZØÐëÒª¾­¹ýµÄÃż÷£¬ËùÒÔÒ²ÓдæÔڵıØÒª£¬µ«ÊÇÌáµÄ¶àÁË£¬ ......

C/C++ÓïÑÔstructÉî²ã̽Ë÷

1. structµÄ¾Þ´ó×÷ÓÃ
¡¡¡¡Ãæ¶ÔÒ»¸öÈ˵ĴóÐÍC/C++³ÌÐòʱ£¬Ö»¿´Æä¶ÔstructµÄʹÓÃÇé¿öÎÒÃǾͿÉÒÔ¶ÔÆä±àдÕßµÄ
±à³Ì¾­Ñé½øÐÐÆÀ¹À¡£ÒòΪһ¸ö´óÐ͵ÄC/C++³ÌÐò£¬ÊƱØÒªÉ漰һЩ(ÉõÖÁ´óÁ¿)½øÐÐÊý¾Ý×éºÏ
µÄ½á¹¹Ì壬ÕâЩ½á¹¹Ìå¿ÉÒÔ½«Ô­±¾ÒâÒåÊôÓÚÒ»¸öÕûÌåµÄÊý¾Ý×éºÏÔÚÒ»Æð¡£´ÓijÖ̶ֳÈÉÏÀ´
˵£¬»á²»»áÓÃstruct£¬ÔõÑùÓÃstructÊÇÇø± ......

C/C++ÓïÑÔvoid¼°voidÖ¸ÕëÉî²ã̽Ë÷

¡¡¡¡1.¸ÅÊö
¡¡¡¡Ðí¶à³õѧÕ߶ÔC/C++ÓïÑÔÖеÄvoid¼°voidÖ¸ÕëÀàÐͲ»ÉõÀí½â£¬Òò´ËÔÚʹÓÃÉϳöÏÖÁËһЩ´íÎó¡£±¾ÎĽ«¶Ôvoid¹Ø¼ü×ÖµÄÉî¿Ìº¬Òå½øÐнâ˵£¬²¢ÏêÊövoid¼°voidÖ¸ÕëÀàÐ͵ÄʹÓ÷½·¨Óë¼¼ÇÉ¡£
¡¡¡¡2.voidµÄº¬Òå
¡¡¡¡voidµÄ×ÖÃæÒâ˼ÊÇ“ÎÞÀàÐÍ”£¬void *ÔòΪ“ÎÞÀàÐÍÖ¸Õ딣¬void *¿ÉÒÔÖ¸ÏòÈκÎÀàÐ͵ÄÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ