STL

Started by
1 comment, last by Masmo 17 years, 9 months ago
Hi I am new to this C++ standard library. My task is that i will get the string as argument and i need to append , replace some characters and return that buffer : void ExpandPath(const _TCHAR* lpszPath); ExpandPath("$cas/abc/123") { ============================== ============================== ============================== ============================== I need to return "K:\\cas\\abc\\123" ; and i will replace "$cas" with "K:\\cas" and later append to "/abc/123". and then,i need to replace '/' with '\\' in the character buffer ! } Any help is greatly appreciated. Thanks for your co-operation
Advertisement
I believe the following would be a step in the right direction.

using std::string;string path = lpszPath;string::size_type start;while (string::npos != (start = path.find("$cas")) {  path.replace( start, strlen("$cas"), "K:\\cas" );}while (string::npos != (start = path.find("/")) {  path.replace( start, 1, "\\" );}return path;
Thanks alot ! It worked straight away !
Once again very much thank you !

This topic is closed to new replies.

Advertisement