I create a TCHAR array as follows:

 unsigned int size = sizeof(working_path) + sizeof(TEXT("\\")) + sizeof(filename) + 1; TCHAR old[size]; _tcscat(old, working_path); _tcscat(old, TEXT("\\")); _tcscat(old, filename); old[size] = '\0'; 

In the program, I specify the working_path as C:\Intel\Logs for example. In the debug window on the third line, I put a breakpoint and see that old already has the value \fЁ›*юяяяЂШ&w…3)w . In the Eclipse settings, the encoding is set to utf-8

Maybe you need to somehow reset after creation?

  • one
    instead of the first *cat(old, ...) should be *cpy(old, ...) . Or it is necessary to put a zero in the first character of old be forced before concatenation. There's also default garbage. - αλεχολυτ
  • @alexolut made TCHAR old[size] = ""; I don’t know if it’s right, but it worked. Just did as you advised. Generally, am I the right size and the like? - Herrgott
  • It makes sense to frame in TEXT() . You can still like this: TCHAR old[size] = {}; . size Standard must be const , by the way (gcc eats because of the support of variable length arrays (VLA)). - αλεχολυτ
  • In the ASCIIz standard, the zero line must end with zero, so here the way out is either cpy or zeroing the first character (empty line) TCHAR old[size] = {0,}; so, or so old[0]=0 in front of all cat, because the default memory is not clean. - nick_n_a

0