22
gcc prints its error messages to stderr, so you have to redirect stderr:
gcc -o foo foo.c 2> foo.gccmessages
You give arguments on the command line always in the same way
./a.out argument1 argument2 argument3