I don't have that much Linux experience but I doubt that it will be any significant change in speed. After all redirecting the output using the > is pretty much the same thing as redirecting it using code. Anyway, if you want to test it adding those lines in main() should be sufficient.