using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Question58371
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter file name: ");
string file = Console.ReadLine();
Stream fsr = new FileStream(@file + ".txt", FileMode.Open, FileAccess.Read);
Stream fsw = new FileStream(@file + "_output.txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter sw = new StreamWriter(fsw);
StreamReader sr = new StreamReader(fsr);
while (!sr.EndOfStream)
{
string temp = sr.ReadLine();
string name = "";
int i;
for (i = 0; i < temp.Length; i++)
{
name += temp[i];
if (temp[i] == ' ')
{
break;
}
}
string ip = "";
/*ip.Remove(2);
ip.Insert(9, "16"); */
int j;
for (j = i + 1; j < temp.Length; j++)
{
ip += temp[j];
if (temp[j] == ' ')
{
break;
}
}
string f = "";
for (i = j + 1; i < temp.Length; i++)
{
f += temp[i];
if (temp[i] == ' ')
{
break;
}
}
string port = "";
for (j = i + 1; j < temp.Length; j++)
{
port += temp[j];
}
sw.WriteLine("set change " + name + " at " + ip + " from " + f + "port " + port + " with activation");
}
sr.Close();
sw.Close();
fsr.Close();
fsw.Close();
}
}
}http://www.AssignmentExpert.com/
Comments