in reply to redirecting the messages
Not sure if this is exactly what you want, since I don't know your platform:
How can I redirect STDOUT and STDERR from a program on WIN32?
HTH,