Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
O

Obukhov

@Obukhov
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • TCHAR to char *
    O Obukhov

    I found the code on [http://www.wincli.com/?p=72]. These two functions is what you need: // returns number of TCHARs in string int wstrlen(_TCHAR * wstr) { int l_idx = 0; while (((char*)wstr)[l_idx]!=0) l_idx+=2; return l_idx; } // Allocate char string and copy TCHAR->char->string // Don't forget to release the allocated memory!!! char * wstrdup(_TCHAR * wSrc) { int l_idx=0; int l_len = wstrlen(wSrc); char * l_nstr = (char*)malloc(l_len); if (l_nstr) { do { l_nstr[l_idx] = (char)wSrc[l_idx]; l_idx++; } while ((char)wSrc[l_idx]!=0); } nstr[l_idx] = 0; return l_nstr; }

    C / C++ / MFC c++ announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups