title: Convert char* argv[] to wstring
body: <p>How can I convert <code>char* argv[]</code> to <code>wstring</code>? I use <code>"/d"</code> to get a string path from <code>argv</code> and insert it as parameter of my function <code>ArrayOfDirContents</code>.</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
      double minimum = 10;
      double input;
      char* filename;
      wstring adr(L".");
      const wchar_t* adresar; 
  
      adresar = adr.c_str();
  
      char *p;
  
      int num;
  
  
      errno = 0;
      long conv;
  
      for (unsigned i = 1; i &lt; argc; i++) {   
          conv = strtol(argv[i], &amp;p, 10);
  
          // Check for errors: e.g., the string does not represent an integer
          // or the integer is larger than int
          if (errno != 0 || *p != '\0' || conv &gt; INT_MAX) {
              // Put here the handling of the error, like exiting the program with
              // an error message
              cout &lt;&lt; "";
          }
          else if(strcmp(argv[1], "/a") == 0) {
              // No error
              num = conv;
              minimum = num;
          }
          else if(strcmp(argv[3], "/d") == 0) {
              int mbtowc(wchar_t* adresar, const char* argv[4], std::size_t n);
          }
          else {
              adresar = adr.c_str();
          }
  
          getchar();
      }
  
          string nazev_souboru;
          vector&lt;string&gt; strpole;
          int chyby, l;
          chyby = 0;
          bool vysledek;
          vysledek = ArrayofDirContents(adresar, nazev_souboru, strpole);
  
          vector&lt;string&gt;::iterator i;
  
          if (vysledek == true) {
              writeFile(nazev_souboru, strpole, chyby, l, minimum);
              writeSms(strpole, chyby, l, minimum);
              for (i = strpole.begin(); i &lt; strpole.end(); i++) {
                  cout &lt;&lt; *i;
                  cout &lt;&lt; '\n';
  
              }
          }
          //SaveDirectoryContents(L".", nazev_souboru);
  
  }
  </code></pre>