as part of a process I launch, a log file is created on disk, is there anyway I can have this output redirected to memory so no file exists, even though the process thinks it's writing to disk?
It may not be the best solution but what you're asking for seems more so like just writing the log to a locally declared space (variable) until the time is required to actually create the file out of it. That would in reality be writing it to memory until you what it to be written to disk
?
____________ signature below ______________
You are a amateur developer until you realize all your code sucks.
Jeff Atwood
This isn't going to work as the API I use expects a string to define the filename, for example "c:\logs\output.log"
What I'm looking for is the same as the Unix devnul. What would work is if this memorystream could be implemented to 'pretend' to be c:\logs\output.log
You can try using "C:\NUL" or "\\.\C:\NUL" with your API and see if the API supports it. This is supposed to be the equivelant of the dev\null file in UNIX, but not all APIs support writing to this file. The .Net FileStream object is one example of an API that does not support this model.
Another option is to just use randomly generated temp files for your log and clean them up after you are done. This may or not help you with your problem, but it may be your only solution if you are limited to the functionality of an existing API.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.