CStrings
-
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."
-
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."
CString doesn't have a 256 char limit. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com
-
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."
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
-
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."
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
-
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