C/C++ÖйØÓÚ±éÀúÎļþ¼ÐµÄ²Ù×÷
#include <windows.h>
#include <stdio.h>
void FindFileInDir(char* rootDir, char* strRet)
{
char fname[256];
ZeroMemory(fname,256);
WIN32_FIND_DATA fd;
ZeroMemory(&fd, sizeof(WIN32_FIND_DATA));
HANDLE hSearch;
char filePathName[256];
char tmpPath[256];
ZeroMemory(filePathName, 256);
ZeroMemory(tmpPath, 256);
strcpy(filePathName, rootDir);
BOOL bSearchFinished = FALSE;
if( filePathName[strlen(filePathName) -1] != '\\' )
{
strcat(filePathName, "\\");
}
strcat(filePathName, "*");
hSearch = FindFirstFile(filePathName, &fd);
//Is directory
if( (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&& strcmp(fd.cFileName, ".") && strcmp(fd.cFileName, "..") )
{
strcpy(tmpPath, rootDir);
strcat(tmpPath, fd.cFileName);
FindFileInDir(tmpPath, strRet);
}
else if( strcmp(fd.cFileName, ".") && strcmp(fd.cFileName, "..") )
{
sprintf(fname, "%-50.50s", fd.cFileName);
strcat(strRet + strRet[strlen(strRet)] , fname);
}
while( !bSearchFinished )
{
if( FindNextFile(hSearch, &fd) )
{
if( (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&& strcmp(fd.cFileName, ".") && strcmp(fd.cFileName, "..") )
{
strcpy(tmpPath, rootDir);
strcat(tmpPath, fd.cFileName);
FindFileInDir(tmpPath, strRet);
}
else if( strcmp(fd.cFileName, ".") && strcmp(fd.cFileName, "..") )
{
sprintf(fname, "%-50.50s", fd.cFileName);
strcat(strRet + strRet[strlen(strRet)] , fname);
}
}
else
{
if( GetLastError() == ERROR_NO_MORE_FILES ) //Normal Finished
{
bSearchFinished = TRUE;
}
else
bSearchFinished = TRUE; //Terminate Search
}
}
FindClose(hSearch);
}
main()
{
}
°ÑÕâ¶Î´úÂ븴ÖÆ¡¡Áí´æΪºó׺Ϊ¡¡£®£Ã£Ð£Ð¡¡Îļþ¡¡È»ºó±àÒë¡¡¿ÉÒÔ±àÒë
ÔÚÀ´¿´¿´ÄãµÄÄǸö
»¨Á˼¸·ÖÖӸijÉÁË¡¡£ÃÓïÑÔ
Ìù³öÀ´ÁË
Äã°ÑϱߵĴúÂ븴ÖÆ
Áí´æΪºó׺Ϊ¡¡.£Ã¡¡µÄÎļþ
È»ºó¡¡±àÒë¡¡¾Í¿ÉÒÔÁË
#include <windows.h>
#include <stdio.h>
void FindFileInDir(char* rootDir, char* strRet)
{
char fname[256];
WIN32_FIN
Ïà¹ØÎĵµ£º
C ÓïÑÔ
CÓïÑÔÊÇÒ»ÖÖ¼ÆËã»úÓïÑÔ£¬¼òµ¥µÄ½²ËüÊÇÎÒÃǺͼÆËã»ú¹µÍ¨µÄÒ»ÖÖ¹¤¾ß£¬Í¨¹ýÕâÖÖÓïÑÔÎÒÃÇ¿ÉÒÔÒýµ¼¼ÆËã»úÈÃËü°´ÕÕÎÒÃǵÄÒâԸȥ×öÊ£¬À´ÎªÈËÀàÌṩ·þÎñ¡£±ÈÈçÄãµçÄÔÖеÄÒôÀÖ²¥·ÅÆ÷¡¢word¡¢qq¡¢Ñ¸À×£¨µ±È»ÕâЩÈí¼þµÄ±àд»¹Ó¦ÓÃÁËÇÒËû¹¤¾ß£©¡£
CÓïÑÔ¿ÉÒÔ×÷Ϊ¹¤×÷ϵͳÉè¼ÆÓïÑÔ£¬±àдϵͳӦÓóÌÐò£¬Ò²¿ÉÒÔ×÷Î ......
va_listÊÇc/c++ÓïÑÔÎÊÌâÖнâ¾ö¿É±ä²ÎÊýµÄÒ»×éºê.ÏÈÀ´¿´Ò»¸ö³ÌÐòÀý×Ó°É.
view plaincopy to clipboardprint?
#include <stdarg.h>
/**¡¡º¯ÊýÃû£ºmax
*¡¡¹¦ÄÜ£º·µ»Øn¸öÕûÊýÖеÄ×î´óÖµ
* ²ÎÊý£ºnum£ºÕûÊýµÄ¸öÊý . ......
ÒýÑÔ
¡¡¡¡C/C++ÓïÑÔÓÐÒ»¸ö²»Í¬ÓÚÆäËüÓïÑÔµÄÌØÐÔ£¬¼´ÆäÖ§³Ö¿É±ä²ÎÊý£¬µäÐ͵ĺ¯ÊýÈçprintf¡¢scanfµÈ¿ÉÒÔ½ÓÊÜÊýÁ¿²»¶¨µÄ²ÎÊý¡£È磺
printf ( "I love you" );
printf ( "%d", a );
printf ( "%d,%d", a, b );
¡¡¡¡µÚÒ»¡¢¶þ¡¢Èý¸öprintf·Ö±ð½ÓÊÜ1¡¢2¡¢3¸ö²ÎÊý£¬ÈÃÎÒÃÇ¿´¿´printfº¯ÊýµÄÔÐÍ£º
int printf ( const ......
½ñÌì×öÁËACM1010
´úÂ붼¶Ô¾ÍÊÇÔõôҲ²»ÄÜAC¡£ÄǸöÓôÃÆ°¡£¡Ò»ÍíÉ϶¼ÏëÄǸöÁË¡£
±¾À´ÓÐÁ©×éÊäÈ룬¿ÉÊÇÊä³öµÄ½á¹û¾ÍÒ»×é¡£×Ðϸ¿´ÊäÈ룬¾¹È»×Ô¶¯»»ÐÐÁË£¬Ææ¹Ö£¬ÕâÊÇÕ¦»ØÊ¡£
²Â²â¿ÉÄÜÊǶÁÈëÁË»»Ðзû¡£Í¬ÑùµÄÎÊÌâÕâC++ÖоÍûÓа¡!
×îºóͨ¹ý¼Ógetchar();ACͨ¹ý¡£ ......
http://docs.google.com/View?docid=ajbgz6fp3pjh_2dwwwwt#_38239340844832237
It is not about optimization.
The whole idea of using 'do/while' version
is to make a macro which will
expand into a regular statement, not into a
compound statement. This is
done in order to make the use of function-s ......