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 or string

CString or string

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 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
    ng kok chuan
    wrote on last edited by
    #1

    what's the difference between CString and string? which one will be better and easier to use? so far i'm always sticking to string, as i learnt it that way. someone please enlighten me the advantages of CString over string.

    C R 2 Replies Last reply
    0
    • N ng kok chuan

      what's the difference between CString and string? which one will be better and easier to use? so far i'm always sticking to string, as i learnt it that way. someone please enlighten me the advantages of CString over string.

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

      CString is Microsoft's string class. It has an easier syntax to the methods that it exposes. I use string by default, and CString if I have to. I'm far more likely to use bstr_t ( converts between wide and narrow strings for you ) than CString. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

      1 Reply Last reply
      0
      • N ng kok chuan

        what's the difference between CString and string? which one will be better and easier to use? so far i'm always sticking to string, as i learnt it that way. someone please enlighten me the advantages of CString over string.

        R Offline
        R Offline
        Rama Krishna Vavilala
        wrote on last edited by
        #3

        string was not thread safe until VS.NET I had to learn that the hard way. I believ with VS.NET when you copy one sring object to another it actually copies the entire contents of the string which can be a issue if you desire high performance. CString doesnot have the same problem. The CString with VS.NET is very impressive and very good. I recommend using it.

        2 1 Reply Last reply
        0
        • R Rama Krishna Vavilala

          string was not thread safe until VS.NET I had to learn that the hard way. I believ with VS.NET when you copy one sring object to another it actually copies the entire contents of the string which can be a issue if you desire high performance. CString doesnot have the same problem. The CString with VS.NET is very impressive and very good. I recommend using it.

          2 Offline
          2 Offline
          224917
          wrote on last edited by
          #4

          CStrings have thread affinity, which can be another reason to not use it.


          suhredayan
          There is no spoon.

          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