/*
* Created by SharpDevelop.
* User: Administrator
* Date: 2006-1-30
* Time: 16:34
* Using C#
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.IO;
namespace list
{
class MainClass
{
public static void Main(string[] args)
{
try
{
int ctr=1;
if(args.Length<=0)
{
Console.WriteLine("命令格式:list filename");
}
else
{
FileStream f=new FileStream(args[0],FileMode.Open);
try
{
StreamReader r=new StreamReader(f);
string line;
while((line=r.ReadLine())!=null)
{
Console.WriteLine("{0}:{1}",ctr,line);
ctr++;
}
f.Close();
}
finally
{
f.Close();
}
}
}
catch(System.IO.FileNotFoundException)
{
Console.WriteLine("找不到指定的文件{0}",args[0]);
}
catch(Exception e)
{
Console.WriteLine("出错:/n{0}",e.Message);
}
}
}
}
* Created by SharpDevelop.
* User: Administrator
* Date: 2006-1-30
* Time: 16:34
* Using C#
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.IO;
namespace list
{
class MainClass
{
public static void Main(string[] args)
{
try
{
int ctr=1;
if(args.Length<=0)
{
Console.WriteLine("命令格式:list filename");
}
else
{
FileStream f=new FileStream(args[0],FileMode.Open);
try
{
StreamReader r=new StreamReader(f);
string line;
while((line=r.ReadLine())!=null)
{
Console.WriteLine("{0}:{1}",ctr,line);
ctr++;
}
f.Close();
}
finally
{
f.Close();
}
}
}
catch(System.IO.FileNotFoundException)
{
Console.WriteLine("找不到指定的文件{0}",args[0]);
}
catch(Exception e)
{
Console.WriteLine("出错:/n{0}",e.Message);
}
}
}
}