Using C++ MFC and Visual Studio 2008.
Sorry for the newbie question, but I'm not sure why this isn't working. I'm making a function that finds the standard illegal characters for XML in a char *
that's passed to it, but I get a strange error.
char* XMLIllegalCharacterParser(char *input){
char *Temp;
for (size_t i = 0; i < strlen(input); i++){
if(input[i] == "\"" || input[i] == "\'" || input[i] == "&")
}
return Temp;
}
1>.\FileImport.cpp(868) : error C2446: '==' : no conversion from 'const char *' to 'int'
I can't for the life of me figure out why it isn't working. What syntax do I have wrong?
PS: I know that I only have 3 of the characters there. I got this error and I wanna fix it before I add the other two.
Here my after code:
char* XMLIllegalCharacterParser(char *input){
char *Temp;
for (size_t i = 0; i < strlen(input); i++){
switch(input[i]){
case '\"':
strcat_s(Temp, 6, """);
break;
case '\'':
strcat_s(Temp, 6, "'");
break;
case '&':
strcat_s(Temp, 5, "&");
break;
case '<':
strcat_s(Temp, 4, "<");
break;
case '>':
strcat_s(Temp, 4, ">");
break;
default:
strcat_s(Temp, 1, (const char*)input[i]);
break;
}
}
return Temp;
}