A Simple C Project

Published by Nazmul Hossain Nihal on

Html5FileCreator

Recently I just learned some basics of C Programming.After learning I made a simple project with C.My project is to make a program that create .html file with some valid Html5 codes.

Here is my codes for main.c :)


#include <stdio.h>
#include <stdlib.h>
/*
This C Program Will Create Basic HTML5 Files.
*/
int main()
{
//This is the main Function

char FileName[20];
printf("================================================================================\n");
printf("==========================WELCOME TO HTML5 FILE CREATOR=========================\n");
printf("================================================================================\n");

printf("Version : 1.0 \nCreated by : Nazmul Hossain Nihal \n\n");

printf("Your file will look like this: \n\n");
printf("\t<!DOCTYPE html>\n\t<html lang=\"en\">\n\t\t<head>\n\t\t\t<title>This File Was Generated by a C Program</title>\n\t\t\t<meta charset=\"UTF-8\" />\n\t\t</head>\n\t\t<body>\n\t\t\t<h1>This is a HTML5 File</h1>\n\t\t</body>\n\t</html>\n\n");
printf("Name your file: ");
scanf("%s",FileName);

char FileData[900] = "<!DOCTYPE html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>This File Was Generated by a C Program</title>\n\t\t<meta charset=\"UTF-8\" />\n\t</head>\n\t<body>\n\t\t<h1>This is a HTML5 File</h1>\n\t</body>\n</html>";

FILE * Fpointer;

Fpointer = fopen(FileName,"w");
fprintf(Fpointer,FileData);
fclose(Fpointer);

printf("Your File %s has been successfully created \n" , FileName);

return 0;

}

Leave a Reply

Your email address will not be published. Required fields are marked *