Streang Mean
Anything at all – name given to a variable and its meaning or its use is entirely in the mind of the beholder. Try this
#include<stdio.h> #include<string.h> int main(int argc, char *argv[], char *env[]) { printf("Content-type:text/html\n\n"); printf("<html>\n); printf("</body>\n"); printf("</html>\n"); return 0; }
what you should see is this:
Or if send a parameter of anything at all you will get surprising results:
What we are doing here is using the string parameter argv[1] as a background colour code inside an HTML body tag. We change the Content-type speciication to text/html and miraculously now our program is generating HTML content. A language being expressed inside another language. Web browsers understand a limited set of colour terms and colours can be also deined hexadecimal codes such as #FFFFFF (white) #FF0000 (red) #00FF00 (green) #0000FF (blue).
This fun exercise is not just a lightweight trick, the idea that one program can generate another in another language is very powerful and behind the whole power of the internet. When we generate HTML (or XML or anything else) from a common gateway interface program like this we are creating dynamic content that can be linked to live, changing data rather than static pre-edited web pages. In practice most web sites have a mix of dynamic and static content, but here we see just how this is done at a very simple level.
Throughout this book we will use the browser as the preferred interface to our programs hence we will be generating HTML and binary image stream web content purely as a means to make immediate the power of our programs. Writing code that you peer at in a terminal screen is not too impressive, and writing window-type applications is not nearly so straightforward.
In practice most of the sotware you may be asked to write will be running on the web so we might as well start with this idea straight away. Most web applications involve multiple languages too such as CSS, (X)HTML, XML, JavaScript, PHP, JAVA, JSP, ASP, .NET, SQL. If this sounds frightening, don’t panic. A knowledge of C will show you that many of these languages, which all perform diferent functions, have a basis of C in their syntax.