Skip to content
systemcoding.dev

Library

Everything you need to level up your coding skills.

Flat illustration of user space above the system call boundary, the kernel and the hardware, with the C, FreeBSD and Linux logos.
Systems Programming

Redirect stdout to a File with dup2

Redirect stdout to a file in C by opening it and calling dup2 onto descriptor 1. Includes saving and restoring the terminal and the fork and exec case.

7 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.