C/VCĿ¼²Ù×÷
C/VCĿ¼²Ù×÷
Ðdz¾ ·¢±íÓÚ 2006-10-11 15:54:00
0
ÍƼö
Ò»¡¢Ä¿Â¼²Ù×÷º¯Êý½éÉÜ
ÔÚVC++µÄ“direct.h”Öж¨ÒåÁËÒÔÏÂ4¸öº¯Êý£º
int chdir(const char *); //change directory
char * getcwd(char *, int); //get current working directory
int mkdir(const char *); //make directory
int rmdir(const char *); //remove directory, the directory must be empty
ÔÚʹÓÃÕâЩº¯Êýʱ£¬±ØÐë°üº¬ÈçÏÂÓï¾ä£º
££i nclude <direct.h>
¶þ¡¢º¯ÊýʹÓþÙÀý
void OnMakeDir()
{
// TODO: Add your control notification handler code here
CString m_TempName;
m_TempName=_T("e:\\testtmp");
CFileStatus rStatus;
if(!CFile::GetStatus(m_TempName,rStatus))
{
if(!mkdir(m_TempName))
{
MessageBox( "Directory 'e:\\testtmp' was successfully created " );
if(!rmdir(m_TempName))
MessageBox( "Directory 'e:\\testtmp' was successfully removed " );
else
MessageBox( "Problem removing directory 'e:\\testtmp' " );
}
else
MessageBox( "Problem creating directory 'e:\\testtmp' " );
}
else
MessageBox("e:\\testtmp is exist!");
}
void CTestDlg::OnGetCurWorkingDirect()
{
char buffer[67];
if(getcwd(buffer,66) == NULL)
MessageBox("getcwd error");
else
MessageBox(buffer);
}
Ïà¹ØÎĵµ£º
// ·½°¸— Óŵ㣺½öʹÓÃC ±ê×¼¿â£»È±µã£ºÖ»Äܾ«È·µ½Ã뼶
#include <time.h>
#include <stdio.h>
int main( void )
{
time_t t = time(0);
char tmp[64];
strftime( tmp, sizeof(tmp), "%Y/%m/%d %X %A ±¾ÄêµÚ%jÌì %z",localtim ......
Ò»¡¢ÇëÌîдBOOL , float, Ö¸Õë±äÁ¿ Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä¡££¨10·Ö£©
Ìáʾ£ºÕâÀï“ÁãÖµ”¿ÉÒÔÊÇ0, 0.0 , FALSE»òÕß“¿ÕÖ¸Õ딡£ÀýÈç int ±äÁ¿ n
Óë“ÁãÖµ”±È½ÏµÄ if Óï¾äΪ£º
if ( n == 0 )
if ( n != 0 )
ÒÔ´ËÀàÍÆ¡£
Çëд³ö BOOL flag Óë“ÁãÖµ”±È½ÏµÄ if ......
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã ......
[CÓïÑÔ]fopen()º¯ÊýµÄ²ÎÊý˵Ã÷
2007Äê06ÔÂ05ÈÕ ÐÇÆÚ¶þ 23:55
¸ñʽ£ºÎļþÖ¸ÕëÃû=fopen(ÎļþÃû£¬Ê¹ÓÃÎļþ·½Ê½)
²ÎÊý£º
ÎļþÃû ÒâÒå
"C:/temp/temp.txt" Îļþ C:\temp\temp.txt
ÎļþʹÓ÷½Ê½ ¡¡ Òâ Òå
“rt”¡¡¡¡¡¡¡¡¡¡Ö»¶Á´ò¿ªÒ»¸öÎı¾Îļþ£¬Ö»ÔÊÐí¶ÁÊý¾Ý
“wt”¡¡¡¡¡¡¡¡ ֻд ......
ÔÚÍøÉÏ¿´µ½ÁËÕâƪÎÄÕ£¬·Ç³£²»´í£¬»ñÒæ·Ëdz£¬ÓÚÊÇת¹ýÀ´£¬Ï£ÍûÄܶԴó¼ÒÓÐËùñÔÒæ¡£ÎÄÕÂÔ×÷Õߣºantigloss http://free3.e-168.cn/antigloss/
ºÜ¶àÈËÉõÖÁÊÐÃæÉϵÄһЩÊé¼®£¬¶¼Ê¹ÓÃÁËvoid main( ) £¬ÆäʵÕâÊÇ´íÎóµÄ¡£C/C++ ÖдÓÀ´Ã»Óж¨Òå¹ývoid main( ) ¡£C++ Ö®¸¸ Bjarne Stroustrup ÔÚËûµ ......