Results 1 to 9 of 9

Thread: CString size?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Question CString size?

    Hi.

    Does anyone know the size limit of a CString variable in kb's?

    Thanks in advance.

  2. #2
    Fanatic Member twanvl's Avatar
    Join Date
    Dec 2001
    Posts
    771
    I don't know, but I think they either use a 32 bit size variable, or a 0-terminated string. In both cases there is basicly nothing to worry about.

  3. #3
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    If you need to put in more data than a CString is capable
    of, then you should rethink your design.

    Try splitting up the data.
    Bababooey
    Tatatoothy
    Mamamonkey

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Hummmmmm.....

    Originally posted by noble
    If you need to put in more data than a CString is capable
    of...
    That's what I have been trying to find out. How much data a CString can hold. I'm still waiting on a definitive answer, by the way ...

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Probably about 2 gig (the limit for a program)

    Although in practice you're most likely to be limited to about 400/500mb...why do you need THAT much data that you need it all in a continuous pointer (i.e. a CString)?

    You need some kind of "chunked" storage, like a deque (STL) or one of the rope classes.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    A locally declare CString is limited to less than 1 MB (max stack size - mem needed by all function calls, which is about 1kB in a high-level MFC call).
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Originally posted by CornedBee
    A locally declare CString is limited to less than 1 MB (max stack size - mem needed by all function calls, which is about 1kB in a high-level MFC call).
    Nope, the strings are always allocated on the heap
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    uh, right parksie, forgot that.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Thumbs up Corned Bee and Parksie ...

    Thanks for the information. I appreciate it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width