We help IT Professionals succeed at work.
Get Started

Passing argument parameters using  __targv[x] with unicode

1,485 Views
Last Modified: 2013-12-14
Hi,

What the trouble is with this code when arguments function (argc , argv ) is used in a UNICODE project. I set in EDI VC6 parameter settings "11.1.1.111 10 the_name"

      else if (__argc==4)  //with 3 parametres (@IP + fps + name)
      {
            CString title = pCVgtLanguage->vgt_translate (&ppCLang, L"000001",L"FXCAMD Configuratorfr :");
            CString space = L"   ";
            CString tempo1 = __targv[1];  // here problem tempo1 contain is "1" isntead of "11.1.1.111"
            CString str_fps = __targv[2];
            WCHAR* c = L"\0";
            gl_str_int = wcstol(str_fps,&c,10); //get the first number
            CString tempo2 = __targv[3];
            CString full = title + space + tempo1 + space + tempo2;
            Gl_ip = tempo1;
            SetWindowText(full);
      }

The goal is to have a const char*  ("11.1.1.111") for Gl_ip CString variables but the contains is not correct and casting is not good because CString don't like it.

The problem is that  tempo1contain is "1".
What is the problem ? __targv[] is for tchar only ? must I use __wargv[] ?

Thank you
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE