?
Solved

CString Crash

Posted on 2006-07-13
3
Medium Priority
?
536 Views
Last Modified: 2013-11-20
I have data from a CComBSTR with size 1,260,082 length.  I assigned it to a CString and it crash.
I thought a CString can handle INT_MAX (2,147,483,647) characters.

Can somebody tell me how to assign a CComBSTR to CString this size.

USES_CONVERSION;
...
CComBSTR bstrInnerHTML;
pBody->get_innerHTML(&bstrInnerHTML);
CString  str = OLE2A(bstrInnerHTML); <<<<<crash right here
0
Comment
Question by:ramrocket
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17106088
what if you try with BSTR:

         BSTR bstrInnerHTML;

         pBody->get_innerHTML(&bstrInnerHTML);

         CString str=bstrInnerHTML;  // OR CString str(bstrInnerHTML);
         
-MAHESH
0
 

Author Comment

by:ramrocket
ID: 17123080
Mahesh,

I am trying your suggestion.  

Is it true that CString object can handle over 2Million characters?
0
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 400 total points
ID: 17123299
I have not seen a limit specified, so the implication is that the limit is the lessor of memory size and the maximum value of an 'int' because notice that CString::GetLength() returns an int. and int would be 32 bits in win32 right? that sure goes a long way at least 4 GB I think ...

-MAHESH
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question