CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );

bOpenFileDialog

Set to TRUE to construct a File Open dialog box or FALSE to construct a File Save As dialog box.

// CFileDialog dlg(false,"TXT",NULL,NULL,"Text file(*.txt)|*.TXT|",NULL);

读取文件:

virtual UINT Read( void* lpBuf, UINT nCount );
throw( CFileException );

lpbuf缓冲区指针

nCount要读的长度

/*


int len=file.GetLength();

char *buffer=new char[len+1];

if(!buffer)

{

MessageBox("Allocating fail");

}

else

{

try

{

file.Read(buffer,len);

}

catch(CFileException *e)

{

MessageBox("Reading file error");

file.Close();

e->Delete();

return ;

}

*/

获取当前时间:

current_time=CTime::GetCurrentTime();

str_year.Format("%d",current_time.GetYear());

str_month.Format("%d",current_time.GetMonth());

str_day.Format("%d",current_time.GetDay());

CString m_date=str_year+"-"+str_month+"-"+str_day;