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. CString::SetAt

CString::SetAt

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 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
    Sunnygirl
    wrote on last edited by
    #1

    hello @all, i want to fill a CString. i tried this: hs1=0; CString m_strTest1; CString minus("-"); m_strTest1.SetAt(hs1, 'minus'); but it does not work. can anybody help me? thanks, sunny

    Z A R M 4 Replies Last reply
    0
    • S Sunnygirl

      hello @all, i want to fill a CString. i tried this: hs1=0; CString m_strTest1; CString minus("-"); m_strTest1.SetAt(hs1, 'minus'); but it does not work. can anybody help me? thanks, sunny

      Z Offline
      Z Offline
      zeki yugnak
      wrote on last edited by
      #2

      hi...:) you have made an error. void SetAt( int iChar, XCHAR ch ); CString::SetAt can add only char.not word!! what do you want to do?

      1 Reply Last reply
      0
      • S Sunnygirl

        hello @all, i want to fill a CString. i tried this: hs1=0; CString m_strTest1; CString minus("-"); m_strTest1.SetAt(hs1, 'minus'); but it does not work. can anybody help me? thanks, sunny

        A Offline
        A Offline
        Abbas_Riazi
        wrote on last edited by
        #3

        :omg: What do you do? Use this code for filling a CString variable:

        CString var=_T("Hello World!");

        Now, var filled with "Hello World!" string. A. Riazi

        1 Reply Last reply
        0
        • S Sunnygirl

          hello @all, i want to fill a CString. i tried this: hs1=0; CString m_strTest1; CString minus("-"); m_strTest1.SetAt(hs1, 'minus'); but it does not work. can anybody help me? thanks, sunny

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          Sunnygirl wrote: m_strTest1.SetAt(hs1, 'minus'); SetAt() expects a character, not a string. You've given a string but encoded it as a character. This will spit out a compiler warning, and is not correct. Just do this;

          CString m_strTest1;
          m_strTest1 = "minus";

          Hope this helps, Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
          Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

          1 Reply Last reply
          0
          • S Sunnygirl

            hello @all, i want to fill a CString. i tried this: hs1=0; CString m_strTest1; CString minus("-"); m_strTest1.SetAt(hs1, 'minus'); but it does not work. can anybody help me? thanks, sunny

            M Offline
            M Offline
            MAAK
            wrote on last edited by
            #5

            if you need to insert a string into certain position there is CString::Insert()

            CString str;
            str.Insert(0, "TEST");
            
            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