Uli Schlachter wrote:
This does work as expected, however redirecting the output via ">>" doesn't work, because the output happens on stderr and not on stdout. If you want to redirect stderr, use "2>>".
Thanks Uli,
that did it!
I still don't get it, because when I tried findscu with the normal redirect I got a full log in the output file.
void prepareCmdLineArgs(int& /* argc */, char** /* argv */,
const char* /* progname */)
{
#ifdef _WIN32
#ifndef DCMTK_GUI
#ifndef __CYGWIN__
/* Map stderr onto stdout (cannot redirect stderr under windows).
* Remove any buffering (windows uses a 2k buffer for stdout when not
* writing to the console. since dcmtk uses mixed stdout, stderr
* cout and cerr, this results in _very_ mixed up output).
*/
/* duplicate the stderr file descriptor be the same as stdout */
close(fileno(stderr));
int fderr = dup(fileno(stdout));
if (fderr != fileno(stderr))
{
char buf[256];
DCMDATA_ERROR("INTERNAL ERROR: cannot map stderr to stdout: "
<< OFStandard::strerror(errno, buf, sizeof(buf)));
}
#ifndef NO_IOS_BASE_ASSIGN
/* make cout refer to cerr. This does not work with all iostream implementations :-( */
cout = cerr;
#endif
/* make stdout the same as stderr */
*stdout = *stderr;
[...]