FLTK 1.3.0
Filenames

Functions

void fl_decode_uri (char *uri)
 Decodes a URL-encoded string.
int fl_open_uri (const char *uri, char *msg, int msglen)
 Opens the specified Uniform Resource Identifier (URI).

Function Documentation

void fl_decode_uri ( char *  uri)

Decodes a URL-encoded string.

In a Uniform Resource Identifier (URI), all non-ASCII bytes and several others (e.g., '<', '', ' ') are URL-encoded using 3 bytes by "%XY" where XY is the hexadecimal value of the byte. This function decodes the URI restoring its original UTF-8 encoded content. Decoding is done in-place.

int fl_open_uri ( const char *  uri,
char *  msg,
int  msglen 
)

Opens the specified Uniform Resource Identifier (URI).

Uses an operating-system dependent program or interface. For URIs using the "ftp", "http", or "https" schemes, the system default web browser is used to open the URI, while "mailto" and "news" URIs are typically opened using the system default mail reader and "file" URIs are opened using the file system navigator.

On success, the (optional) msg buffer is filled with the command that was run to open the URI; on Windows, this will always be "open uri".

On failure, the msg buffer is filled with an English error message.

Example

 #include <FL/filename.H>
 [..]
 char errmsg[512];
 if ( !fl_open_uri("http://google.com/", errmsg, sizeof(errmsg)) ) {
     char warnmsg[768];
     sprintf(warnmsg, "Error: %s", errmsg);
     fl_alert(warnmsg);
 }
Parameters:
uriThe URI to open
msgOptional buffer which contains the command or error message
msglenLength of optional buffer
Returns:
1 on success, 0 on failure