The title maybe a little confusing.. so here is my attempt of explaining it:
I have a command for my program:
c file1.txt > file2.txt
This command in the commandline takes the first file and pipes the output of the program (that is printed) to the second file.
So im scanning a user message in:
printf("Enter a message:");
char *message = malloc(sizeof(char) * 256);
scanf("%s", message);
printf("Your message is: %s", message);
But this prints both printf(...)
statements to my piped file, whereas I only want the second one. How can i prevent this?
Thanks!