CString::Replace in C++ without MFC
-
Can anybody either a) provide me with a C\C++ function that mimicks CString::Replace in functionality, or b) explain in detail (i.e. step by step) how to do this myself? I have tried for ages, but can;t get anything that works. :(( Thank you, Russell McCurly Hobbiest Programmer
-
Can anybody either a) provide me with a C\C++ function that mimicks CString::Replace in functionality, or b) explain in detail (i.e. step by step) how to do this myself? I have tried for ages, but can;t get anything that works. :(( Thank you, Russell McCurly Hobbiest Programmer
can't offer code, but have a look at std::string, from the C++ standard library.. (#include ) - it has members such as find_first_of() and replace() that you should be able to use quite easily to perform the CString::Replace() functionality. happy coding!
-
Can anybody either a) provide me with a C\C++ function that mimicks CString::Replace in functionality, or b) explain in detail (i.e. step by step) how to do this myself? I have tried for ages, but can;t get anything that works. :(( Thank you, Russell McCurly Hobbiest Programmer
It's not a trivial task because the text being replaced may be larger or smaller (in length) than the text to replace it with. I recommend looking at CString::Replace's source code to get some ideas. Even better, use the debugger to step into the function to see it in action. If you want, you may also post your source code and we'll try to spot the problems. Regards, Alvaro