À©µµ¿ì ÇÁ·Î±×·¡¹Ö ÀÚ·á |
---|
Á¦¸ñ | [MFC] µð·ºÅ丮 Áö¿ì±â 1998/11/28 (09:46) |
À̸§ | ±èÈ¿¿ø |
¹øÈ£ | 67 |
Á¶È¸ | 694 |
º»¹® |
¡ºMFC ÇÁ·Î±×·¡¸Ó µ¿È£È¸-ÀæÀº Áú¹® ¸ðÀ½ (go MFCPRO)¡» 123¹ø Á¦ ¸ñ:[Á¤º¸] µð·ºÅ丮 Åëä·Î ³¯¸®±â ¿Ã¸°ÀÌ:kiss (¿øÀ¯½Å ) 98/11/18 20:05 ÀÐÀ½: 50 °ü·ÃÀÚ·á ¾øÀ½ ----------------------------------------------------------------------------- ¾Æ·¡ ÆÄÀÏ µð·ºÅ丮 API¸¸À¸·Î´Â ÇÏÀ§ µð·ºÅ丮±îÁö Åëä·Î ³¯¸®´Â°É ©¼ö°¡ ¾ø´õ±º¿©.-_-; (Á¦°¡ ¸øãÀº°ÇÁö.) ±×·¡¼ Á¦°¡ MFC¸¦ ÀÌ¿ëÇؼ Çϳª ®½À´Ï´Ù. recursive call ¿¡´Ù°¡. È÷µç°ú read only±îÁö ¼ø½Ä°£¿¡ ³¯·Á¹ö¸®´Ï.. ½ÅÁßÇÏ°Ô »ç¿ëÇϽʽÿä.. µð¹ö±ëÀ» ¾²¸é¼.^^. ³É..¸¹ÀºÀ̵鿡°Ô µµ¿òÀÌ µÇ±æ ¹Ù¶ó¸é¼. int dir_remove(CString dir_path ) { int count = 0 ; CFileFind ff ; CString fn , fp ; CFileStatus fs ; CString strPath ; strPath.Format("%s\\*.*" , dir_path) ; if (!ff.FindFile((LPCTSTR)strPath)) { AfxMessageBox("FindFile Error") ; exit(1) ; } BOOL bEnd = FALSE ; while (!bEnd) { if (!ff.FindNextFile()) bEnd = TRUE ; fn = ff.GetFileName() ; fp = ff.GetFilePath() ; if(ff.IsDots()) continue ; else { count ++ ; if (!CFile::GetStatus((LPCTSTR)fp , fs)) { TRACE( "Error\n" ) ; ff.Close() ; exit( 1 ) ; } if (fs.m_attribute & 0x01) { // read only fs.m_attribute ^= 0x01 ; CFile::SetStatus((LPCTSTR)fp , fs) ; } if( ff.IsDirectory() ) { TRACE("%s dir\n", fn ) ; dir_remove( fp ) ; TRACE("\n" ) ; } else { TRACE("%s file\n", fn ) ; remove((LPCTSTR) fp) ; } } } ff.Close(); TRACE( "dirpath = %s\n", dir_path ) ; ::RemoveDirectory( dir_path ) ; return 1 ; } |