TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ANDREY DROZDOV
from: KURT KUZBA
date: 1997-12-19 14:36:00
subject: .

AD>   typedef struct mas_strok
AD>   {
AD>      char name[13];
AD>   } STR;
AD>   STR MAS_STROK[100];
AD>   : "Cannot convert 'char *' to 'mas_strok'
   I don't know what happened to the rest of the message, but
   this got through.
   Your actual array is inside the structure.
typedef struct
{ char name[13]; } STR;
STR *MAS_STROK = new STR[100];
   Trying to create an array of 100*13 on the stack may be
   unwise. It is better to allocate.
   You might also prefer to use a class in this case.
class Name
{
public:
   Name();
   ~Name();
   void operator =(char*);
   const char *GetName(void);
private:
   char *pszName;
}
Name::Name(void) { Name = new char[13]; }
Name::~Name(void) { delete []Name; }
const char *Name::GetName(void) { return const pszName; }
void Name::operator=(char *N) { sprintf(pszName, "%.12s", N); }
   Now you can simply create an array of classes, and have the
   use of the = operator for your strings.
Name *MAS_STROK = new Name[100];
MAS_STROK[0] = "Kurt";
cout GetName() << endl;
   this should prevent you having massive strokes while
   attempting to use structures as quoted above. :)
> ] I don't know if I'm lighting candles or dancing.............
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.