63 lines
1.4 KiB
C++
63 lines
1.4 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 <iostream>
|
|
|
|
#define SIZE_LINE 1000+1
|
|
|
|
using namespace std;
|
|
|
|
void creaFile(const char * nomeFile);
|
|
|
|
int main(void) {
|
|
creaFile("test.html");
|
|
|
|
cout << "Check the output file." << endl;
|
|
|
|
return 0;
|
|
}
|
|
|
|
void creaFile(const char * nomeFile) {
|
|
FILE * file = fopen(nomeFile, "wt");
|
|
|
|
if (file != NULL) {
|
|
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);
|
|
|
|
fclose(file);
|
|
} else {
|
|
perror("Error (source)");
|
|
}
|
|
} |