Skip to content. | Skip to navigation

Personal tools

You are here: Home / Sonstiges / Usefull insigths / flush before fork

flush before fork

or the stuff gets written twice

If you use a buffered output function like fprintf you have to flush the associated filedescriptor/stream before calling fork, otherwise the buffer will be duplicated by fork an the output is written twice.