[CODE] char arrays

From: Andrew (object@ALPHALINK.COM.AU)
Date: 10/05/98


Hi all,

I'm trying to design my own events system, using a queue type method.
What I need to do is store certain information (in this case a command)
into a char array. I'll give you an example...

char eventarray[30000];

void set_event(int time, long idnum, char *comm)
{
   eventarray[0] = *comm; /* Put's all of comm into 0 */
}

That's a part of my code. I can see what it's trying to do - it's trying
to put a large string into the space designed to hold only a single byte.

But I have seen bits of code that look like this....

char stuff[] = {"Hello", "how", "are", "you?"};

and then stuff[0] points to Hello, stuff[1] points to how etc. etc.

Any ideas?

Andrew Ritchie.

| Andrew Ritchie, object@alphalink.com.au.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST