[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[Cdt-launch-inbox] [Bug 102043] Console Output Does Not Appear When Launching An Application
|
https://bugs.eclipse.org/bugs/show_bug.cgi?id=102043
------- Additional Comments From eric@xxxxxxxxxxxxx 2005-09-11 10:11 -------
I strongly agree with comments 12 and 14.
I'm a brand-new user of Eclipse, the first thing I did was install CDT and
follow your online tutorial - which promptly produced garbled results for a two
line 'hello, world!'
I was lucky enough to find this bug in the google search, but it wasn't easy.
To provide some more helpful debugging info,
This program:
===
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char **argv) {
string s, s2;
if (argc < 2) {
cerr << "usage: " << argv[0] << " <firstname>" << endl;
exit(1);
}
cout << "enter name: ";
cin >> s;
s2 = argv[1];
if (s != s2) {
cerr << "names don't match! Using argument value: " << argv[1]
<< endl;
cout << "Hello1, " + s << endl;
s = s2;
cout << "Hello2, " + s << endl;
}
cout << "Hello, " + s << endl;
// fflush(stdout);
sleep(1);
return(0);
}
===
works as expected at the command line:
===
C:\Documents and Settings\Eric Safern\workspace\hW\Debug>hw e
enter name: ee
names don't match! Using argument value: e
Hello1, ee
Hello2, e
Hello, e
===
but in the console, even with the sleep, the cout and cerr are intermingled.
===
enter name: e
names don't match! Using argument value: Hello1, e
Hello2, Eric
Hello, Eric
Eric
===
You can't tell without color, :-) but the words 'value:' and the final 'Eric'
are in red, indicating cerr.
Note the behavior is consistent for me from run to run.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.