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)
|