TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DONNIE BENNERS
from: DARIN MCBRIDE
date: 1997-07-10 20:08:00
subject: THREE QUESTIONS

 -=> Quoting Donnie Benners to Nathan Cline
 NC>      char *Monster_Name;          /* you had unsigned char, you have
 NC>                                      to have an * for a string.  */
 DB> You also need to allocate space for the string either with malloc or
 DB> calloc. Dos won't always complain, but it can sure cause some hard
 DB> problems to troubleshoot! You could also define it as:
 DB> char Monster_Name[20]; // good round number
 
 NC>       Monster_Name = "Bear";
 DB> Most string require stuff like:
 DB> strcpy(Monster_Name, "Bear");
Well, not quite.  "Bear" is a constant character pointer.  (In fact, it
is often read-only memory in protected systems, like Win32, OS/2, and 32-bit
DOS.)
char* m = "Bear";
works.
char* m;
strcpy(m, "Bear");
can give you random results.
char* m = "Bear";
for (int n = 0; m[n]; ++n)
    m[n] = toupper(m[n]);
can give you random results (although DOS generally doesn't care).
But the code that Nathan posted is fine.
... Go straight to the docs.  Do not pass GO.  Do not collect $200!
___ Blue Wave/OS2 v2.30
--- FastEcho 1.46
---------------
* Origin: House of Fire BBS - Toronto - (416)601-0085 - v.34 (1:250/536)

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™.