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
Solved

CString Crash

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 126
wait notify demo infinite loop 3 122
building a service to accessed via telnet client, want colors ? 4 92
"Black Box" Testing of Control System Software 2 70
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 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