Re: pass the html file to a browser to open there



On 8/13/05, Hubert Sokołowski <h sokolowski wsisiz edu pl> wrote:
#ifdef __WIN32__
#define BROWSER "explorer"
#else
#define BROWSER "firefox"
#endif

void print_open (const gchar *path)
{
  GError *error = NULL;
  gchar *s;

  s = g_strdup_printf ("%s %s", BROWSER, path);
  if (!g_spawn_command_line_async (s, &error))
    ... // show some error message and free error
  g_free (s);
}

I also have:

#ifdef WINDOWS
        int v;

        v = (int) ShellExecute( NULL, "open", url, NULL, NULL, SW_SHOWNORMAL );
        if( v <= 32 ) {
                error_top( _( "Unable to open location." ) );
                error_sub( _( "Unable to open URL \"%s\", "
                        "windows error code = %d." ), url, v );
                box_alert( par );
        }
#elif defined MACOSX
        (void) systemf( "open %s", url );
#else /*unix-y*/
        ... something like hubert's code
#endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]