String Problems
-
Hi i have one CString which has text in it, i wish to scan thsi text and replace all the "\" with another charature. However every time i try to search the string looking for the "\" using strchr etc all i get is an error message saying error C2001: newline in constant any help on how to slove this?
-
Hi i have one CString which has text in it, i wish to scan thsi text and replace all the "\" with another charature. However every time i try to search the string looking for the "\" using strchr etc all i get is an error message saying error C2001: newline in constant any help on how to slove this?
it is "\"", not "\" use strchr(p, '\"') is better or CString.Replace() function do you mean "\\" or '\\'?
-
it is "\"", not "\" use strchr(p, '\"') is better or CString.Replace() function do you mean "\\" or '\\'?
-
i'vew tried both Replace() and strchr and they dont find the \ in the string, i tried str.Replace('\"', 'A') and it did nothing, if i change the '/"' to another letter in the string it replaces them perfectly. any idea whats up? thanks
the \ is '\\' in code. includeh10
-
i'vew tried both Replace() and strchr and they dont find the \ in the string, i tried str.Replace('\"', 'A') and it did nothing, if i change the '/"' to another letter in the string it replaces them perfectly. any idea whats up? thanks
Because "\" is an escape character prefix you have to write "\\" if you mean the "\". You can also escape other characters with the single \, e.g. \n \r \" Regards Konrad