title: Conversion problem from char * to wchar_t*
body: <p>The below line works. It prints Success.</p>
  
  <pre><code>wchar_t * s1 = (wchar_t *) L"INSERT INTO OE(sqltext) VALUES('this text')";
  
  if(WriteToSQL(s1) == 0)
    printf( "Success");     //Success
  else
    printf( "Failed");     
  </code></pre>
  
  <p>I need to take user input to create dynamic sql. I need to do what 
  L prefix is doing.</p>
  
  <p>When i take input and do the required conversion, it does not work.</p>
  
  <pre><code>char input[100]; 
  char sql[500];  
  
  printf("Enter input string :: "); 
  fgets(input,100,stdin); 
  for(int i=0;i&lt;100;i++) 
      if(input[i]==10) 
          input[i]=0; 
  
  strcpy(sql,"INSERT INTO OE(sqltext) VALUES('"); 
  strcat(sql,input); 
  strcat(sql,"')"); 
  
  wchar_t wsql[500];  
  MultiByteToWideChar( CP_UTF8, 0, sql, strlen(sql), 
  wsql, strlen(sql) + 1 );  
  
  
  if(WriteToSQL(wsql) == 0)
    printf( "Success");     
  else
    printf( "Failed");     // It failed
  </code></pre>
  
  <hr>
  
  <p>Long conversassion but finally it did work. Hex memory dump and input from usta was most helpful. Thanks everybody for their time.</p>