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. CStrings

CStrings

Scheduled Pinned Locked Moved C / C++ / MFC
databasequestion
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.
  • C Offline
    C Offline
    Chris Klecker
    wrote on last edited by
    #1

    Does CString and LPCTSTR only carry as much as 256 characters or is there a way to augment this to carry what I want. I have a SQL query that is 289 characters long and I'm needing a string variable that could carry it. (shuffling through MSDN. yuck) Thanks! "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

    R J N 3 Replies Last reply
    0
    • C Chris Klecker

      Does CString and LPCTSTR only carry as much as 256 characters or is there a way to augment this to carry what I want. I have a SQL query that is 289 characters long and I'm needing a string variable that could carry it. (shuffling through MSDN. yuck) Thanks! "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      CString doesn't have a 256 char limit. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com

      1 Reply Last reply
      0
      • C Chris Klecker

        Does CString and LPCTSTR only carry as much as 256 characters or is there a way to augment this to carry what I want. I have a SQL query that is 289 characters long and I'm needing a string variable that could carry it. (shuffling through MSDN. yuck) Thanks! "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

        J Offline
        J Offline
        Jamie Nordmeyer
        wrote on last edited by
        #3

        Nope. If you dig through the MFC Source, you'll discover that it stores the string in a LPTSTR variable called m_pchData. Looking further, LPTSTR is defined as char * or wchar * (depending on whether or not you're using UNICODE). So in essence, CString can handle strings as large as your have memory for. Jamie Nordmeyer Portland, Oregon, USA

        1 Reply Last reply
        0
        • C Chris Klecker

          Does CString and LPCTSTR only carry as much as 256 characters or is there a way to augment this to carry what I want. I have a SQL query that is 289 characters long and I'm needing a string variable that could carry it. (shuffling through MSDN. yuck) Thanks! "Why are we hiding from the police, Daddy?" "We use VI, son. They use Emacs."

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #4

          CString::GetLength() returns an int [32 bit number in win32] So I guess if you have that much RAM, then that's the limit.... a 32 bit number can have a max value of 4,294,967,295 and GetLength() returns the byte count thus we can have that many bytes [approx 4.29 GB] in a CString :-) Hmmmm wait wait wait I think int means signed-integer if that's the case then we only have 2.14 GB :-) Nish

          realJSOPR 1 Reply Last reply
          0
          • N Nish Nishant

            CString::GetLength() returns an int [32 bit number in win32] So I guess if you have that much RAM, then that's the limit.... a 32 bit number can have a max value of 4,294,967,295 and GetLength() returns the byte count thus we can have that many bytes [approx 4.29 GB] in a CString :-) Hmmmm wait wait wait I think int means signed-integer if that's the case then we only have 2.14 GB :-) Nish

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #5

            It's not unsigned, so it's 2gb. To hell with those thin-skinned pillow-biters. - Me, 10/03/2001

            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