Writing to /dev/null on Windows with Fortran

From Fortran, I use /dev/null on Linux/Mac/BSD/WSL/Cygwin and NUL on Windows to get 10x faster speed on programs where output files are not wanted.

Example Null-writing Fortran code

Too much disk writing from old Fortran code

Legacy Fortran code might dump data to disk, maybe lots of data that is slow and unused. Making slight changes to adapt these legacy Fortran programs to Python using f2py. I don’t want to hack around in the code commenting out or if’ing all those write statements. Thus I implement the null-writing behavior noted above.



Leave a Comment