I'm having trouble building in a pipe, i have program
reads in from argv using fgets
spilts up using strtok into command,cmd and cmd2.
then i have a if statement
then i open the file for writing
strcmp(filename, cmd2); file2=open(filename, O_WRONLY);
now im confussed where to go. I been reading examples using dup2, something like
which writes it to stdin
but how to get it from stdin to a file?
im jut generally confused,
i do now i need to execute the command . i.e ls
then change the output of that from stdout (1) to a file.