please help me out...
As the subjekt tells; I have a privat char array in a class
and 2 public functions, one to Set Name and one to Get Name.
but, I don't know how to return a string/char array
I need to use the GetName function in the win32 wsprintf() fucntion, which is like the sprintf() as far as I know?!?
so...
how do i return a char array from a function?
and how do I use the function return in wsprintf()???
here is my code...
Code:
class Fighter
{
public:
void SetName(char NameSet[]);
char* GetName();
private:
char Name[];
};
void Fighter::SetName(char NameSet[])
{
strcpy(Name, NameSet);
}
char* Fighter::GetName()
{
return Name;
}
//somewere in winprog
int szBuffer[100]
wsprintf (szBuffer, TEXT ("%s"), User.GetName() );
MessageBox (NULL, szBuffer , "Name", 0 + MB_DEFBUTTON1 + MB_ICONASTERISK);
my problem is realy more c++ then win32 I think...
thats all... please reply
I can attach my full projekt if you ask!