run other programm

I have the programm, that says to STDERR(not to STDOUT!): "hello world!" and this programm is compiled and I have no sources.
When I try to open this programm in another using C:

FILE *pp = popen("hello_to_stderr.exe", "r");
int c;
string a;
while( (c=getc(pp)!=EOF ) a +=char(c);

the "a" string doesn't get anithing! But i see the words
"hello world!" on a screen! It simply outputs the STDERR!
How can I get the STDERR thread?
And how can I make it work on both Linux and MSWindows?

For unix:
popen("hello_to_stderr.exe 2>&1", "r")
should work since the command line is passed to a shell for interpretation.

I don't know if that will work on windows. And I would guess that it would depend onthe compiler or more accurately, the library that comes with the compiler. If you try it on windows, please post back and tell us if it worked and mention which windows os and which compiler you tried.

Yes! It works in windows!
I use "gcc for windows" (I don't remember how have I got it - it was a long time ago) you can find it at my ftp:
http://take-1.biz/dn/gcc.exe - its over 2-3 MB.

windows was XP, but i think it will work even in 95 - download the compiler and start the "bin/jfe.exe" -

And it really works! Thank you!