Wiky
Wiky

Reputation: 152

open file in system default application in C

I'm writing a simple http program which downloads a file,maybe .html, .jpg or any others
and how can i open the file using the system default application in C code
This program is on ubuntu12.10 and based on gtk3.x
sorry for my English and thanks in advance.

Upvotes: 0

Views: 141

Answers (1)

Wiky
Wiky

Reputation: 152

I know that

GFile *g_file_new_for_path(const gchar *path);

GAppInfo *g_file_query_default_handler(GFile *file,GCancellable *cancellable,GError **error);

gboolean g_app_info_launch(GAppInfo *appinfo,GList *files,GAppLaunchContext *launch_context,GError **error);

Create a GFile and get its default handler,then launch it
g_app_info_launch will return TRUE if success

Upvotes: 1

Related Questions