By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,820 Members | 1,187 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,820 IT Pros & Developers. It's quick & easy.

problem with add old string to new string in edit box (MFC)

P: n/a
Tio

my code:
if (new data )
{

CString* pStr = (CString*)wParam; //data come with some
com port (PostMessage)
CString p2Str; //old string in edit box
m_dataa.GetWindowText(p2Str);

*pStr= p2Str+*pStr; // add old string to new string

m_dataa.SetWindowText(*pStr); // send new string to edit box
delete pStr;

}

in first step I have in edit box "12345"
then come new data "6789"
so it should be after adding two string "12345 6789" in edit box but
is "12345 89"
why I lost two signs?

Jun 14 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Tio wrote:
my code:
if (new data )
{

CString* pStr = (CString*)wParam; //data come with some
com port (PostMessage)
CString p2Str; //old string in edit box
m_dataa.GetWindowText(p2Str);

*pStr= p2Str+*pStr; // add old string to new string

m_dataa.SetWindowText(*pStr); // send new string to edit box
delete pStr;

}

in first step I have in edit box "12345"
then come new data "6789"
so it should be after adding two string "12345 6789" in edit box but
is "12345 89"
why I lost two signs?


First of all, nothing in your code suggests you're adding a space between
your strings. Perhaps the operator+ for 'CString' does that, I don't know
since CString is not a standard class. Perhaps you're not telling us all
like it is in reality (like 'p2Str' actually contains a space after "5" or
that new data has a space in front of it).

Second, whatever you do that causes this malfunction, is most likely not
in this code, but rather outside, in the code you didn't post.

Third, your program's functionality depends on MFC (apparently), and this
is not the right place to discuss MFC issues. Try
'microsoft.public.vc.mfc'.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 14 '06 #2

P: n/a
Off topic (MFC specific CString class) and multi-posted.
Jun 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.