2
Vote

StreamReader support...

description

Hi.

Thank you for ZetaLongPaths.

I would like to request the ability to use a StreamReader with a long file path.

For example,
using (StreamReader sr = ZlpIOHelper.OpenTextFile(longFilePath))
{
     string line;
     while ((line = sr.ReadLine()) != null)
     {
          Console.WriteLine(line)
     }
}
When not using a long file path, System.IO.File.OpenText() would be used here.

This has also been requested here:
http://code.google.com/p/zetalongpaths/issues/detail?id=3

Thank you.

comments

icnocop wrote Mar 25, 2013 at 7:55 PM

I found out that the Microsoft Base Class Libraries LongPath's Microsoft.Experimental.IO namespace supports this already as follows:

http://bcl.codeplex.com/releases/view/42783
using (FileStream fs = LongPathFile.Open(longFilePath, FileMode.Open, FileAccess.Read))
using (StreamReader sr = new StreamReader(fs))
{
     string line;
     while ((line = sr.ReadLine()) != null)
     {
          Console.WriteLine(line)
     }
}