Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

CString variable for multiline edit box not big enough?

Posted on 2005-03-08
9
Medium Priority
?
346 Views
Last Modified: 2013-11-20
I have a dialog with a multiline edit box that pops up when a button is clicked on another dialog. Information on the original dialog is to be displayed in the multiline edit box of this new popped up dialog. I gave the edit box a variable of type Cstring, and appended all the information to this Cstring, then in the end, write this Cstring out to the multiline edit box, but it seems it can hold up to 3 lines only...when I have more stuff appended teh old lines get overwritten...does this mean Cstring is limited to a certain number of characters? and how can I make it so that it'll let me append more lines to it to be displayed in teh edit box?
0
Comment
Question by:jade03
  • 5
  • 4
9 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 13489341
Hi jade03,
> >does this mean Cstring is limited to a certain number of characters?
It would take a lot more then 3 lines to reach the CString limit.

Can you post your code?
Can you show how you're appending the information?

What type of data do you have in the CString?  

Does it include binary none-printable characters?

David Maisonave :-)
Cheers!
0
 
LVL 30

Expert Comment

by:Axter
ID: 13489365
jade03,
FYI:
A CString object can store up to INT_MAX (2,147,483,647) characters.
See following link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_strings_in_mfc.asp

David Maisonave  :-}
0
 

Author Comment

by:jade03
ID: 13489467
here's what I have (note, CShowInfo is a class created so that I could manipulate the look and feel of the edit box (ie changing it's bg color, text color etc), and the variable in that class, m_allInfo is a CString):

CShowInfo info;
CString finalStr;

      // string together all fields
      finalStr = "Debug:\t\tDebug Level [0-9], amount of output olsrd sends to stdout.\r\n";
      finalStr = finalStr + "IPVersion:\tIP Version olsrd is used. Default = 4\r\n";
      finalStr = finalStr + "Hna4:\t\tAnnounce connectivity to external networks using HNA messages (internet connectivity, set 0.0.0.0.0.0.0.0)\r\n";
      finalStr = "Interface:\tNetwork interface on which olsrd should run.\r\n";
      finalStr = finalStr + "AllowNoInt:\tKeeps running if no network interfaces are available? Defaults to yes\r\n";
      finalStr = finalStr + "Loadplugin:\tPlugin that olsrd is to load at startup. Must be absolute path, or loader will, ";
      finalStr = finalStr + "1) try paths in LD_LIBRARY_PATH, 2) List libraries cached in /etc/ld.so.cache, 3) /lib, followed by /usr/lib\r\n";
      finalStr = "IP4Broad:\tForces the given IPv4 broadcast address to be used as destination address for all outgoing OLSR traffic. 'auto' uses address every card is configured with.\r\n";
      finalStr = finalStr + "IP6AddrType:\tIPv6 address scope; Must be 'site-local' or 'global'.\r\n";
      finalStr = finalStr + "IP6Multi-Site:\tIPv6 multicast address to use when using site-local addresses. 'auto' uses default ff05::15.\r\n";
      


      info.m_allInfo = finalStr;

        // call child dialog to popup
      info.DoModal();
0
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!

 

Author Comment

by:jade03
ID: 13489488
currently only the last 3 lines show up in my edit box when teh new dialog pops up
0
 
LVL 30

Accepted Solution

by:
Axter earned 100 total points
ID: 13489646
finalStr = "Interface:\tNetwork interface on which olsrd should run.\r\n";

The above line is overwriting everything added to the string in the previous three lines
0
 
LVL 30

Expert Comment

by:Axter
ID: 13489652
finalStr = "IP4Broad:\tForces the given IPv4 broadcast address to be used as destination address for all outgoing OLSR traffic. 'auto' uses address every card is configured with.\r\n";

The above line is also overwriting everything added in the previous lines.
0
 

Author Comment

by:jade03
ID: 13489675
oh my gosh! can't believe I overlooked the missing "finalStr + " thing on that line! Axter, thank you sooo much for catching that....it works now... :)
0
 
LVL 30

Expert Comment

by:Axter
ID: 13489695
>>oh my gosh! can't believe I overlooked the missing "finalStr + " thing on that line! Axter, thank you sooo much for catching that....it works now... :)

Sometimes you just need a second pair of eyes to look at it.
0
 

Author Comment

by:jade03
ID: 13489872
yes, so much for my trying to save myself some typing by doing cutting and pasting....

your tip has saved me from going crazy and pulling my hair out over it...cuz I kept staring at it and couldn't find anything wrong w/ it...

u guys are great!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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.

581 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