0

Possible Duplicate:
/dev/null in Windows?

I have a complex code that encodes input file into output file. Usually its 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 dont 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 question. Its 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 i have save for changing my complex code or deleting the produced file after closing it?

Community
  • 1
  • 1
Istrebitel
  • 2,963
  • 6
  • 34
  • 49

1 Answers1

1

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

http://support.microsoft.com/kb/40592

paulsm4
  • 114,292
  • 17
  • 138
  • 190