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. Append one string at begin of another

Append one string at begin of another

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
7 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.
  • S Offline
    S Offline
    skaanji
    wrote on last edited by
    #1

    Is there some way to append one string at begin of another? using STL or W32API not MFC

    S Z 2 Replies Last reply
    0
    • S skaanji

      Is there some way to append one string at begin of another? using STL or W32API not MFC

      S Offline
      S Offline
      Scozturk
      wrote on last edited by
      #2

      char string1 = "Hello"; char string2 = "I am scolinks"; strcat(string1,string2); SetDlgItemText(hwnd,IDC_APPENDED, string1); I hope this helps.... Well... I am a beginner ...

      S M 2 Replies Last reply
      0
      • S Scozturk

        char string1 = "Hello"; char string2 = "I am scolinks"; strcat(string1,string2); SetDlgItemText(hwnd,IDC_APPENDED, string1); I hope this helps.... Well... I am a beginner ...

        S Offline
        S Offline
        skaanji
        wrote on last edited by
        #3

        strcat() appends string2 to end of 1st string i need some function which does opposite. but thanks anyway.

        J 1 Reply Last reply
        0
        • S skaanji

          Is there some way to append one string at begin of another? using STL or W32API not MFC

          Z Offline
          Z Offline
          ZoogieZork
          wrote on last edited by
          #4

          Maybe I'm missing the point of your question? :confused:

          std::string orig = "foo";
          std::string ins = "String to insert at beginning ";
          /* ... */
          std::string combined = ins + orig;

          - Mike

          S 1 Reply Last reply
          0
          • S skaanji

            strcat() appends string2 to end of 1st string i need some function which does opposite. but thanks anyway.

            J Offline
            J Offline
            JohnJ
            wrote on last edited by
            #5

            Duh:| strcat(string2,string1); See msdn Library[^]:sigh: John Hudson An imaginary Chris Maunder standing in front of mirror is misquoted remarking: Nothing says "you're not normal" more than the little things. :wtf: http://www.rainbow-innov.co.uk[^]

            1 Reply Last reply
            0
            • Z ZoogieZork

              Maybe I'm missing the point of your question? :confused:

              std::string orig = "foo";
              std::string ins = "String to insert at beginning ";
              /* ... */
              std::string combined = ins + orig;

              - Mike

              S Offline
              S Offline
              skaanji
              wrote on last edited by
              #6

              This is exactly what i need.:)

              1 Reply Last reply
              0
              • S Scozturk

                char string1 = "Hello"; char string2 = "I am scolinks"; strcat(string1,string2); SetDlgItemText(hwnd,IDC_APPENDED, string1); I hope this helps.... Well... I am a beginner ...

                M Offline
                M Offline
                Michael Dunn
                wrote on last edited by
                #7

                :confused::confused::confused: Nice buffer overrun there ;) --Mike-- Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber Ericahist updated (again) Sep 6!

                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