|
-
April 15th, 1999, 09:17 AM
#1
Copying a string
void VRLessonRecord::SetPath(const CString &src, const CString &dst, const CString &path )
{
}
I have this function where I want to set the path.
The variable path = "C:\LAVAC\LECONS\L0000001"
src = "C:\LAVAC\LECONS"
dst = "C:\CARO"
I need to be able to switch in the path C:\LAVAC\LECONS to C:\CARO
Can anyone help me!
Thank You
-
April 15th, 1999, 09:44 AM
#2
Re: Copying a string
I think the following code will help you out.
int SlashIndex = path.ReverseFind('\\');
int PathLength = path.GetLength();
path = dst + path.Right(PathLength - SlashIndex);
However since the CString references in your function are declared as const, you will not be able to perform the last assignment to path. I think you also need to remove the const declaration for the CString reference to path.
Chris
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
|