I have a situation where my existing program prints the output to a file. However, I want to redirect the file IO to nowhere. Ideally, I would like to avoid the file IO transactions altogether. For example,
My intension is to change the pointer fw_t to point to nowhere. How can I do this? And if I am able to point it to "nowhere", will the performance improve because there is no file I/O?
You will have to check it yourself, probably by setting it to NULL. It will definitely be faster though, since I/O is generally the slowest operation you can perform.
Just a reminder: if you set the file pointer to null and you're actually calling some member functions of FILE somewhere in your code WITHOUT checking whether fw_t is null, you'll get errors, instead of performance boost.