Reading from a text file on your local computer is easy, but surely using a URL to point to a different location should work too?
The code I have thus far is as follows
However when this runs the "ArgumentExcept ion was unhandled" box pops up and says "URI formats are not supported."
All I want to do is read the contents of that text file, use it as the value of a variable or array and display it on the console. Is this possible?
Thanks everyone!
The code I have thus far is as follows
Code:
using System; using System.IO; namespace csharp_station.howto { class TextFileReader { static void Main(string[] args) { // create reader & open file TextReader tr = new StreamReader("http://jamesgeddes.com/wttr.txt"); // read a line of text Console.WriteLine(tr.ReadLine()); Console.WriteLine("Enter your name"); string s7 = Console.ReadLine(); Console.WriteLine("Hello, {0}!", s7); // close the stream tr.Close(); } } }
All I want to do is read the contents of that text file, use it as the value of a variable or array and display it on the console. Is this possible?
Thanks everyone!
Comment