Writing HTML from GSLThe Gsharp Script Language contains specific functions for creating and setting Gsharp graphics, and also functions for general file I/O. The GSL I/O functions can be used to output the HTTP header and HTML commands needed to dynamically construct web pages. This section will guide you through a GSL script that constructs a very simple web page and explain the basic techniques that will be used as you develop your own dynamic web applications.To output HTML, an output function must be used. GSL includes the following I/O functions, which closely correspond to the ANSI C functions of the same name:
These functions can be used to output text to stdout or a file. When using
standard system files, such as stdout, as the output file, fopen and fclose
do not need to be called, as these files are managed by the system. Here
are the access id's for the standard system files:
stdin 0 stdout 1 stdmsg 2 Creating an HTML file without libhtml.gslGSL I/O functions can be called from a program to create a simple HTML page. Here is a short example:
Creating an HTML file with libhtml.gslIf you prefer you could create the same file using the functions in libhtml.gsl
This program can be run using the command:
When this GSL is run, the file hello.html is created. You can see
the result here.
Now carry on to CGI programming with GSL |