I am unable to read content from .txt file using StreamReader class of c#
I am unable to read content from .txt file using StreamReader class of c# Here is my code..I am trying to read data from .txt file which was stored in music folder. But i am getting some error like, System.NotSupportedException. The given path's format is not supported. Please help........... string path = @"Music:streamfile.txt"; using (StreamReader sr = File.OpenText(path)) { String s = ""; while ((s = sr.ReadLine()) != null) { Console.WriteLine(s); } } Console.ReadLine(); I agree - @"Music:streamfile.txt"; doesn't look like a valid path; where is it actually . Note: the current user's Music folder is: %USERPROFILE%Music , so you might want @"%USERPROFILE%Musicstreamfile.txt" - but you might need to do an env expand first, not sure - try it! – Marc Gravell ♦ Jun 29 at 9:57 ...
