Email

nazmul.hossain@nihal.one

Home / Blog / A Simple C Project

A Simple C Project

by | Feb 2, 2015 | 0 comments

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;

}

0 Comments

Submit a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Goodreads Updates

Goodreads Read Shelf

Steve Jobs
Zero to One: Notes on Startups, or How to Build the Future
The Tipping Point: How Little Things Can Make a Big Difference
The Fault in Our Stars
Harry Potter and the Sorcerer's Stone
The One Thing: The Surprisingly Simple Truth Behind Extraordinary Results
How to Win Friends and Influence People
Outliers: The Story of Success
Rich Dad, Poor Dad
The Power of Habit: Why We Do What We Do in Life and Business
Who Moved My Cheese?
Blink: The Power of Thinking Without Thinking
Good to Great: Why Some Companies Make the Leap... and Others Don't
Sapiens: A Brief History of Humankind
We Should All Be Feminists
A Brief History of Time
The Happiness Project: Or Why I Spent a Year Trying to Sing in the Morning, Clean My Closets, Fight Right, Read Aristotle, and Generally Have More Fun
What the Dog Saw and Other Adventures
Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones
David and Goliath: Underdogs, Misfits, and the Art of Battling Giants