Im trying to create a command "background" that runs a program in the background, and redirects standard in, out, and error. (this command should take at least four arguments)
void background(char *file){
int filename = open(file, O_CREAT | O_TRUNC | O_WRONLY); //with O_CREAT -> no effect if file already exists
//O_TRUNC -> reset its content if it does exist
dup2(filename, STDOUT_FILENO);
close(filename);
}
the command should ignore any > or & characters included
i get the error: "error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
50 | __open_missing_mode ()"