fixed two bugs

This commit is contained in:
David Anderson 2005-08-02 07:46:41 +00:00
parent 5cbcd34bec
commit 688c12ac8b
2 changed files with 14 additions and 2 deletions

View File

@ -130,7 +130,7 @@ public:
bool empty()
{
if (!v)
return false;
return true;
if (v[0] == '\0')
return true;
@ -369,6 +369,8 @@ private:
strcpy(n, v);
if (v)
delete [] v;
else
strcpy(n, "");
v = n;
a_size = d + 1;
}

View File

@ -33,6 +33,7 @@
#define _INCLUDE_CSTRING_H
#include <string.h>
#include <stdio.h>
//by David "BAILOPAN" Anderson
class String
@ -58,6 +59,13 @@ public:
assign(src);
}
const char * _fread(FILE *fp)
{
Grow(512, false);
char *ret = fgets(v, 511, fp);
return ret;
}
String(String &src)
{
v = NULL;
@ -122,7 +130,7 @@ public:
bool empty()
{
if (!v)
return false;
return true;
if (v[0] == '\0')
return true;
@ -361,6 +369,8 @@ private:
strcpy(n, v);
if (v)
delete [] v;
else
strcpy(n, "");
v = n;
a_size = d + 1;
}