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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. TCHAR* and LPTSTR

TCHAR* and LPTSTR

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
22 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K kelprinc

    Does anybody know how to assign a TCHAR* fromo a LPTSTR. This is my code: p->shi502_netname ="test"; LPTSTR h =p->shi502_netname ; TCHAR* var = h; cout< output: t when I try to print out h i get the first letter of string pointed to by h; I thing im no accessing the string from the pointer correctly Kelvin Cikomo

    P Offline
    P Offline
    Prakash Nadar
    wrote on last edited by
    #21

    if you are using unicode build then you should use unicode set of apis to work on them. If you really need to work on multibyte string then you may have to use WideCharToMultiByte api to do the convertion.


    -Prakash

    1 Reply Last reply
    0
    • K kelprinc

      I get wrong out puts if i try this. let me just give you part of my code PSHARE_INFO_502 BufPtr,p; //SHARE_INFO_502 shInfo; //PSHARE_INFO_502 pShInfo = &shInfo; NET_API_STATUS res; LPTSTR lpszServer = NULL; DWORD er=0,tr=0,resume=0, i; //declare server variable lpszServer = lpszArgv[1]; cout<shi502_netname; cout<

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #22

      as i can see from here, your real problem is probably not cout<. I guess that cout statement is a debug output statement. if you want to fix that part, you have to use wcout and it will print properly. Is there any other problem in your code beside printing? * * * -Prakash

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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