It’s because the data is buffered. Write more data and you will see that the file will grow. I beleive the data is buffered by the shell, not sure something can be done about that.
you can control the buffer size with setbuf or setvbuf
also you can flush the buffer with fflush()
note that stderr is not buffered by default
stdout is line buffered, so a ‘\n’ in the output will flush that line.
I know I can do those changes - but I don’t really want to go there (changing the source files, that is) - I just want the stdout to be redirected. Nothing more.
The ‘\n’ is already present in the printf (as one can see in the shown source) - I reckon the the file should be updated, but it just isn’t
Colin, are you sure about this. From my observation, the bufferering method changes whether the data is sent to the screen (no redirection) or to a file. I always assumed this was because the shell was involved in the redirection. I did a little test and the shell isn’t involved, BUT when sent to a file \n doesn’t flush the line, a fflush is required. Probably have to do with the fact that the file is not a terminal device.
I don’t see any other way then to put a setvbuf in the source code, or write a custom resmgr that behaves like a terminal.