constchar* Name = (constchar*) method()->getName(); //this returns a lpcwstr, that's why I cast it
constchar* Str[12];
//the following is because original string is a "double char precision"
for(int iter = 0; iter< 22; iter=iter+2)
Str[iter/2] = Name + iter;
and I want to:
[*] print out the String Str with a printf
[*] compare Str with this string "custom" using strcmp(Str, "custom);
I have a lot of problems since print Str only prints the first char, but I want to print and compare the whole string. please let me know!
Don't try to cast around problem unless you know what the problem is and your cast makes sense. If the compiler is giving you an error saying that the types don't match, casting will not fix the error, it will just silence the compiler (which is a bad thing, because your program will not work as you expect).
The easy solution is to just use the right type:
LPCWSTR Name = method()->getName();
there's also no need for that /2 thing you're doing in the for loop. Just copy the data over normally:
1 2 3
char Str[12];
for(int i = 0; i < 12; ++i)
Str[i] = char( Name[i] );