#include <stdio.h>
#include <stdlib.h>
#define NOME_FILE_HTML "Tabellina9.html"
#define MIO_TITOLO "Creato da un mio programma C!"
#define HTML_TOP "<html>\n<head>\n<title>" \
MIO_TITOLO \
"</title>\n</head>\n"
#define BODY_START "<body bgcolor=\"#FFFFFF\">\n"
#define HTML_BOTTOM "</body>\n</html>"
int main()
{
int i;
FILE *Fp1;
Fp1 = fopen(NOME_FILE_HTML, "w");
if (Fp1 == NULL) {
printf("Non posso aprire il file %s\n", "generato.html");
exit(-1);
} fprintf(Fp1, "%s\n", HTML_TOP);
fprintf(Fp1, "%s\n", BODY_START); fprintf(Fp1, "%s\n", "<h1> Tabellina del 9</h1>");
fprintf(Fp1, "%s\n", "<p>");
fprintf(Fp1, "%s\n", "<table border=1 width=10%>");
for (i=1; i<= 4; i++)
{
fprintf(Fp1, "<tr>\n");
fprintf(Fp1, "<td>-- %d --</td>\n", i*9 );
fprintf(Fp1, "</tr>\n\n");
}
fprintf(Fp1, "%s\n\n", "</table>");
fprintf(Fp1, "%s\n", "<br /> Queste sono le prime 4 righe della \
tabellina del nove!");
fprintf(Fp1, "%s\n", "<\p>"); fprintf(Fp1, "%s\n", HTML_BOTTOM); fflush(Fp1);
fclose(Fp1);
return 0;
}