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. Limit on size of a CString?

Limit on size of a CString?

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 Posts 3 Posters 1 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.
  • J Offline
    J Offline
    Jason Douglas
    wrote on last edited by
    #1

    Does anyone know what the limit for the length of a single CString is? I thought it was 255 characters, but I can't find any documentation on it. Any references to documentation on this would be appreciated as well. I'm using MFC 6.0. Thanks, Jason :confused:

    E A 2 Replies Last reply
    0
    • J Jason Douglas

      Does anyone know what the limit for the length of a single CString is? I thought it was 255 characters, but I can't find any documentation on it. Any references to documentation on this would be appreciated as well. I'm using MFC 6.0. Thanks, Jason :confused:

      E Offline
      E Offline
      Erik Funkenbusch
      wrote on last edited by
      #2

      No, it's not 255 characters. There are limits on the length of strings in resources and other places, but the only limit is the length of the CString length variable, which is a signed int. Thus, assuming you have enough virutal memory space, you can create strings up to 2GB.

      1 Reply Last reply
      0
      • J Jason Douglas

        Does anyone know what the limit for the length of a single CString is? I thought it was 255 characters, but I can't find any documentation on it. Any references to documentation on this would be appreciated as well. I'm using MFC 6.0. Thanks, Jason :confused:

        A Offline
        A Offline
        Andy Hassall
        wrote on last edited by
        #3

        From the topic 'Strings in MFC' (from VC5.0 documentation, YMMV): "A CString object can store up to INT_MAX (2,147,483,647) characters. "

        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