using System;
using System.IO;
namespace TXTtoHTML
{
class Program
{
static void Main()
{
Console.Write("Enter name of file: ");
string nameFileTxt = Console.ReadLine();
string nameFileHtml = nameFileTxt.Substring(0, nameFileTxt.Length - 4);
if (File.Exists(nameFileTxt))
{
StreamReader myfileTxt;
StreamWriter myfileHtml;
myfileTxt = File.OpenText(nameFileTxt);
myfileHtml = File.CreateText(nameFileHtml + ".html");
string line;
myfileHtml.WriteLine("");
myfileHtml.WriteLine("");
myfileHtml.WriteLine("" + nameFileHtml + "");
myfileHtml.WriteLine("");
myfileHtml.WriteLine("");
do
{
line = myfileTxt.ReadLine();
if (line != null)
myfileHtml.WriteLine("" + line + "");
}
while (line != null);
myfileHtml.WriteLine("");
myfileHtml.WriteLine("");
myfileTxt.Close();
myfileHtml.Close();
}
}
}
}