Convert char to TCHAR * argv []

How can I enter text in TCHAR* argv[]?

OR: How can I convert from charto TCHAR* argv[]?

char randcount[] = "Hello world";

TCHAR* argv[];

argv = convert(randcount);
+3
source share
2 answers

One way to do this:

char a[] = "Hello world";
USES_CONVERSION;
TCHAR* b = A2T(a);
+4
source
    #include <iostream>
   TCHAR* Converter(char* cha)    
   {
       int aa = strlen(cha);
       TCHAR* tmp = new TCHAR[aa+1];
       for(int i = 0; i< aa+1; i++)
          {
            tmp[i]=cha[i];
          }
       return tmp;
   }

   int main()
   {
       char* chstr= new char[100];
       chstr = "char string";
       TCHAR* Tstr = new TCHAR[100];
       //Below function "Converter" will do it
       Tstr = Converter(chstr);
       std::cout<<chstr<<std::endl;
       std::wcout<<Tstr<<std::endl;
   }
0
source

Source: https://habr.com/ru/post/1741439/


All Articles