Solved

CString Crash

Posted on 2006-07-13
3
501 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
  • 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 100 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
GIF file bit manipulation for color change 5 104
Host to IP 7 73
Replacement selected text 2 47
withoutTen challenge 14 88
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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now