>> are redirection operators for FD's (File Descriptors)
In bash you have tree standard FD's that are the standard input (strin), the standard output (strout) and the standard error (strerr). These can also be called by FD 0, FD 1 and FD 2 respectively.
Normally you would have you would have all FD's pointing to the terminal, but this can be changed by using redirection.
For example, if you call:
command > log.txt
You will redirect the output to the file log.txt
This is similar as calling:
command 1> log.txt
As this only redirects strout you will still be able to see the error in the terminal.
In order to redirect strerr to you log.txt file you will have to run:
command 2> log.txt
Again, this only redirects strerr. If you wish to redirect both stdout and stderr you need to duplicate your stderr output to stdout by using the
command 1> log.txt 2>&1
To understand this command you need to read it form right to left, first a copy of stderr is made to stdout, then strout is redirected to the log.txt file.
When you use redirection in this way, bash will not look if the file exists or not and simply create one regardless if that implies erasing the existing one. If you want to avoid loosing what has already been written in your log file you can then use the
>> command in the same ways explained above, but in this case all the outputs will be appended to existing files.
For their use in C++ with cin, cout and cerr I think hash gave a better answer than I could.
I'm not an expert in these so I might have gotten some things wrong. For a more complete information I advise reading Bash guide on Greg's Wiki