![]() |
| |||||||
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 |
| Registered User Join Date: Nov 2003
Posts: 6
| VC++ Sending data from a structure in one class to a ListBox in a second class. Code: m_lbInventory.AddString(CItems::PopulateShop(*holder)); Code: void CItems::PopulateShop(CString* holder)
{
*holder = ShopList.m_sName;
}
The error I receive is: error C2664: 'PopulateShop' : cannot convert parameter 1 from 'const char' to 'class CString *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast In that particular case I tried to use pointers in order to get the data, I am not very good with pointers yet and likely did not use them properly. Am I heading in the right direction with the pointers? Or should I be attempting to do this in a completely different way? |
| Burlock is offline | |
| | #2 |
| Registered User Join Date: Mar 2003
Posts: 3,898
| Study this and read tutorial Code: #include <iostream>
#include <string>
using namespace std;
void set_string(string &ref_string)
{
ref_string = "setting reference parameter";
}//set_string
void set_string(string *ptr_string)
{
*ptr_string = "setting pointer parameter";
}//set_string
int main()
{
string s1, s2;
set_string(s1);
set_string(&s2);
cout << "s1 = " << s1 << endl;
cout << "s2 = " << s2 << endl;
return 1;
}//main
gg |
| Codeplug is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| data structure design for data aggregation | George2 | C# Programming | 0 | 05-20-2008 06:43 AM |
| Screwy Linker Error - VC2005 | Tonto | C++ Programming | 5 | 06-19-2007 02:39 PM |
| binary tree token problem | OldSchool | C++ Programming | 13 | 05-28-2006 10:42 PM |
| Tab Controls - API | -KEN- | Windows Programming | 7 | 06-02-2002 09:44 AM |
| Deleting Data within a Structure or class | TankCDR | C++ Programming | 1 | 02-01-2002 10:37 PM |