Solved

CString Crash

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASCII Non-Printable characters/codes and their HTML equivalents 6 117
sum67 challenge 35 99
sum28 challenge 31 112
no14 challenge 14 69
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

803 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