I want to create an html file using C and as the first step , I wrote a simple program as follows:
But the puts(str) statement is giving unexpected result.What is getting printed is "<html><head>My Name Name ad>". Why doesnt it print "<html><head>My Name </html></head>" as is expected? .Ultimately I want to write the string str to the html file using file operation. I tried adding a null character at the end of str, but that throws some illegal operations exceptions and Turbo C is terminated ubruptly.Thanks in advanceCode:#include<stdio.h> #include<conio.h> #include<string.h> void main() { char *name="My Namel",*str=""; clrscr(); strcat(str,"<html><head>"); strcat(str,name); strcat(str,"</html></head>"); puts(str); getch(); }