TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CLIFF RHODES
from: JASON REYNOLDS
date: 1997-03-19 01:17:00
subject: Help with Classes

 CR> Jason, I would assume you are interested in arrays of chars rather than
 CR> single chars. If you have a newer compiler, you can use the C++ String
 CR> class. Look for it in your documentation. If you don't have it, you can
 CR> do something like the following:
 CR>     // For array of chars
 CR>     const char const * GetPlayerStr(void) const { return itsStr; }
 CR>     void SetPlayerStr(const char *s) {
 CR>              if(itsStr) delete [] itsStr;      // If used, free it
 CR>              itsStr = new char[strlen(s) + 1]; // Get new memory
 CR>              strcpy(itsStr, s);  }             // Copy the string
You were right in what I needed.  It's working excellent except one thing.  
I'm having problems with it saving to a file.  I'd like to use binary 
formatted file saving, but text will do also.  I'm trying fin & fout 
currently, but just need something that will work.  Is it not saving because 
it's an array of char's?  Please help me out...  Thanks in advance!
                                Learning the C++ skill...
                                Jason Reynolds
--- Maximus 3.01
---------------
* Origin: The Other Side (605)342-7335/Rapid City SD (1:293/640)

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