Aller au contenu. | Aller à la navigation

Outils personnels

Vous êtes ici : Accueil / 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.