61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
/*
|
|
Nome: Mario
|
|
Cognome: Montanari
|
|
Classe: 3AIN
|
|
Data: 09/04/2025
|
|
|
|
es13. (paginaweb)
|
|
Scrivere un programma che generi automaticamente una pagina web di nome
|
|
test.html avente il seguente contenuto testuale:
|
|
<!doctype html>
|
|
<html lang="it">
|
|
<head>
|
|
<meta charset='UTF-8'>
|
|
<title>Pagina generata automaticamente</title>
|
|
</head>
|
|
<body>
|
|
<p style='color: red;'>
|
|
Questa pagina è stata generata automaticamente
|
|
da un programma scritto in linguaggio C.
|
|
</p>
|
|
</body>
|
|
</html>
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#define SIZE_LINE 1000+1
|
|
|
|
void creaFile(FILE * file);
|
|
|
|
int main(void) {
|
|
FILE * file = fopen("test.html", "wt");
|
|
|
|
if (file != NULL) {
|
|
creaFile(file);
|
|
|
|
printf("Check the output file.\n");
|
|
|
|
fclose(file);
|
|
} else {
|
|
perror("Error (source)");
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void creaFile(FILE * file) {
|
|
fputs("<!doctype html>", file);
|
|
fputs("<html lang='it'>", file);
|
|
|
|
fputs("<head>", file);
|
|
fputs("<meta charset='UTF-8'>", file);
|
|
fputs("<title>Pagina generata automaticamente</title>", file);
|
|
fputs("</head>", file);
|
|
|
|
fputs("<body>", file);
|
|
fputs("<p style='color: red;'>Questa pagina è stata generata automaticamente da un programma scritto in linguaggio C.</p>", file);
|
|
fputs("</body>", file);
|
|
|
|
fputs("</html>", file);
|
|
} |