extract from tar gz into folder

C++
mkdir foo
tar -xzf bar.tar.gz -C foo
Source

Also in C++: