Skip to content
Advertisement

Redirect the standard output [closed]

Hello and thank you for attention. I am writing my own shell in c and i have problem with redirect the standard output. For example, I get command: ls -l >> file and I need to display output to file. Can you give me some ideas to resolve that problem? Thanks.

Advertisement

Answer

You may want to use dup() & dup2(), here are two functions I have ready:

JavaScript

Here is how to use it:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement