read any ".txt" file
Hi,
I am new to C# and trying to read in any .txt file that will be dropped in a directory, I will not have control of the file name.
Here is a sample of my calling code:
class Program
{
static void Main(string[] args)
{
FlatFileTo850 t = new FlatFileTo850();
string data = File.ReadAllText("C:\\src\\partner\\ConsoleApplica tion1\\subdir\\testFile.txt");
//would like to take out the file name "testFile.txt"
//and grab any .txt file
string result = t.Evaluate(ref data);
Console.WriteLine(result);
using (StreamWriter sw = new StreamWriter("TestFileXX.txt", true))
{
sw.Write(result.Replace("~", "~\r\n"));
}
Console.ReadLine();
}
}
Thanks in advance for any help.
Rod
|