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. How can I append LPTSTR to CStirng

How can I append LPTSTR to CStirng

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 6 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.
  • N Offline
    N Offline
    NoName II
    wrote on last edited by
    #1

    subj.

    C L H T T 5 Replies Last reply
    0
    • N NoName II

      subj.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      CString s; LPCTSTR st; s += CString(st); in fact, I thought s += st would work. Christian Graus - Microsoft MVP - C++ -- modified at 4:25 Friday 9th June, 2006

      1 Reply Last reply
      0
      • N NoName II

        subj.

        L Offline
        L Offline
        Laxman Auti
        wrote on last edited by
        #3

        NoName II wrote:

        How can I append LPTSTR to CStirng

        Here is another way how we can append the LPTSTR to CString

        CString strTest("Hello");
        LPTSTR lpStr=" World";
        strTest.Insert(strTest.GetLength(),lpStr);

        We can directly add the strings using += operator as it overloaded in CString class Knock out 't' from can't, You can if you think you can :cool:

        1 Reply Last reply
        0
        • N NoName II

          subj.

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          See LPTSTR lpt; lpt=(LPTSTR)LocalAlloc(LPTR,256); strcat(lpt,"test"); CString str; // str.SetString(lpt,4); // str=lpt; str=str+lpt; str.Insert(0,lpt); str.Append(lpt); LocalFree(lpt);_**


          **_

          whitesky


          1 Reply Last reply
          0
          • N NoName II

            subj.

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            have you ever tried the simplest way (with + or += operators) ?

            CString str = "hello ";
            str += "world !!";


            TOXCCT >>> GEII power

            [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

            1 Reply Last reply
            0
            • N NoName II

              subj.

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              NoName II wrote:

              How can I append LPTSTR to CStirng

              LPTSTR pSz="ALOK loves"; LPTSTR pSz2="CP" CString Combined Str=CString(pSz)+CString(pSz2);

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

              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