0

Possible Duplicate:
/dev/null in Windows?

I have a complex code that encodes input file into output file. Usually it's used just for that, but now I need to make another mode - I need to calculate something along the way of encoding and return that variable. I don't want the output file to remain on the disk, or even appear on the disk for that matter. Its irrelevant in this mode.

Alterating the complex code to add cases like "if we are in mode x then do not actually write to file" is out of the question. It's too complex.

Is it possible to open something like the "black hole" that /dev/null on UNIX systems is as a FILE in C (on MS Windows PC)? Meaning that you have a legit FILE* pointer, can write there (fprintf) correctly, but when you close it, it vanishes with no more cleanup required?

If not - what choices do I have save for changing my complex code or deleting the produced file after closing it?

0

1 Answer 1

1

As it happens, DOS ripped off Unix "/dev/null": "NUL". You should be able to use it even in Windows today:

https://web.archive.org/web/20120202063311/http://support.microsoft.com/kb/40592

Not the answer you're looking for? Browse other questions tagged or ask your own question.