So let's see the code you have so far. Tell us which part of the code doesn't seem to be working as you wish. If you're stuck on how to do something, enter each of these commands at the shell prompt:
Code:
man gettimeofday
man localtime
man sprintf
man 3 system
man cp
man sscanf
These will be directed to C programmers, but they can be used by C++ programmers as well.