]> jfr.im git - irc/gameservirc.git/blame - gameserv/myString.cpp
added myscript.cpp to srcs
[irc/gameservirc.git] / gameserv / myString.cpp
CommitLineData
138b009f 1#include "myString.h"
2
3myString::myString(char *s)
4{
5 setString(s);
6}
7
8myString::~myString()
9{
10 if (string)
11 delete [] string;
12
13 string = NULL;
14}
15
16void myString::setString(char *s)
17{
18 if (!s)
19 {
87137def 20 if (string)
21 delete [] string;
22
23 string = NULL;
138b009f 24 }
25 else
26 {
27 string = new char[strlen(s) + 1];
28 memset(string, 0, (strlen(s) + 1));
29 strcpy(string, s);
30 }
31}