Solved

CString Crash

Posted on 2006-07-13
3
518 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 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 172
ffmpeg - "rtsp://...... Operation not permitted" 4 89
fix34  challenge 9 164
x-bar in Google Sheets 2 93
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 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