Hi,
I have created an on-the-side project to test some code which I hope to merge with my main program, however I've noticed that the output generated varies between two compilers (VC++ 2005 Express and Dev-C++). Since I am doing the project in VC++, it's output has had me scratching my head for some time now. I would be extremely grateful if anyone can suggest a reason for the inconsistency between the two compilers.
VC++ Input:
Enter: a 2 3
a 2 3²²²²½½½½½½½½■ε■ε■ε■
Dev-C++ Input:
Enter: a 2 3
a 2 3
The code used in both compilers:
#include <string>
#include <iostream>
using namespace std;
void standardInput(string command);
int main()
{
string tempStr;
cout << "Enter: ";
cin >> tempStr;
cout << endl;
standardInput(tempStr);
cin.get();
}
void standardInput(string command)
{
char *line;
string strLine;
int length;
getline(cin, strLine);
strLine.insert(0,command);
length = strLine.length();
line = new char[length];
memset(line,'\0',length);
strLine.copy(line,length);
cout << line << endl;
delete [] line;
}
Thanks for any input, at all.