I have a custom string class that uses an array of chars,
class MyString
{
private:
int length;
char *chars;
public:
MyString(const char* input)
{
length = 0;
while (input[length] != '\0')
++length;
chars = new char[length + 1];
for (int j = 0; j < length; j++)
chars[j] = input[j];
}
However when I use this class with a simple output I am getting a strange result in the console:
MyString newStr = "Test";
cout << newStr;
Gives me this output in the console:
Test═²²²²½½½½½½½½■ε■ε■ε■
This is with Visual Studio 2010 Win32 console app. I don't really know c++ very well and this is my first try at it.