0

For example, for .png I'd like to receive mspaint, ois, chrome (these are programs that can view png files on my Windows machine).

Of course there is always

HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\.png\\OpenWithList

but I'm looking for a cross platform way to do that.

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
Alex
  • 34,581
  • 26
  • 91
  • 135

1 Answers1

1

There is no cross platform way, according to this thread. But you could use some platform-specific ways that do similar things. For example, you could use the open command on OS X, or xdg-open for Linux (as described here). It looks like you already know how to do it on Windows, which is good because I don't.

For example:

#ifdef __APPLE__

void open_image(){
    system("open someimage.png");
}

#endif
Community
  • 1
  • 1
  • He wants to get a *list* of associated programs, not opening the file with the default program. – phuclv Aug 08 '16 at 11:27