I am using command:
./cpp-generator > ~/log.log
But when I open the log.log the file is shortened. It ends in the middle of a word. But if I run just:
in terminal, the result is whole, full output.
Ok, so as @StéphaneChazelas said the possible cause is that ./cpp-generator is killed Terminal has line-based buffering instead of block buffering in ./cpp-generator so this is why the terminal will print the all output.
I gave ./cpp-generator enough time to print the message, but because it run in loop I always end it with ctrl + c - therefore I killed it and block-based buffers does not have a chance to write out to the file...
working solution is run ./cpp-generator like this:
stdbuf -o0 cpp-generator > log.log