What is the best way open/edit a data Stream if all I have is a MIME type

I am in a Windows Desktop application and I have a data stream and a mime type in the database. Is there a better way than writing it to a temp folder and launching the default editor for it?

If I have to use the temp folder how can I get the file extension from the MIME type in a C# Windows Desktop application?

Answers


Lookup the MIME type in HKEY_CLASSES_ROOT\MIME\Database\Content Type to find out the corresponding file extension and go from there. Some starter links:

If that is not enough, maybe libmagic (used by the file command line tool) or its database can be of use to you, even though it is quite UNIX:y.


Need Your Help

How to suppress specific warnings in g++

c++ gcc g++

I want to suppress specific warnings from g++. I'm aware of the -Wno-XXX flag, but I'm looking for something more specific. I want some of the warnings in -Weffc++, but not all of them. Something l...

Why won't this standard Reg Ex work in PHP's ereg function

php html regex

I am a bit of a newbie to Reg Ex and don't fully understand the difference between the different flavors. However, I have a basic Reg Ex that works when I try it via the UNIX system (vi and grep) b...