|
-
April 8th, 2013, 04:46 AM
#2
Re: String passing between functions in VC++ SDI application
 Originally Posted by maxer
Code:
Void sendtext(CString str)
{
// do some operations
................
pView->displaytext(str);
}
void displaytext(CString inr)
{
CListCtrl &ctlsde = this->GetListCtrl();
ctlsde.InsertColumn(1, _T("First "), LVCFMT_LEFT, 80);
int nItem;
nItem = ctlsde.InsertItem(0, inr);
}
- Better way to pass CString into a function is by const reference, not by value! Like
Code:
void sendtext(const CString& str)
...
void displaytext(const CString& inr)
- What is pView?
- Is your displaytext a global function? Then what is this pointer within it?
Last edited by VictorN; April 8th, 2013 at 05:11 AM.
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|