|
-
October 3rd, 2008, 06:10 AM
#1
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
-
October 3rd, 2008, 06:58 AM
#2
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:\\.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|