-
Cut String Position
Hi All
I want to cut string.String is "C:\\Abc\\ad\\ta.txt" and i want to cut these \\ad\\ta.txt. And new string like this C:\\Abc.
I want to cut String After Directory and first file or Folder.I am useing this code.
Code:
CString DirPath;
CString FullPath = _T("C:\\abc\\cd\\as.txt");
int nPos = FullPath.Find( _T('\\') );
if( nPos >= 0 )
{
DirPath = FullPath.Mid( 0, nPos);
}
AfxMessageBox(DirPath);
Plz help me
-
Re: Cut String Position
And what is the actual problem? You should repeat that operation twice, if you want to remove C:\\abc, not just C:\\.