hey everyone!
In amongst my C# learning i'm starting to fiddle around with some basic code
on stuff that interests me. So I decided to write a really simple console
app that basically opens and reads the first line of a text file and then
saves the result to a variable.
Well clearly i'm so lame and new that i'm having trouble actually assigning
the result to a variable lol :)
So here is the guts of what I wrote initially
// *** silly text reader program ***
// Open the file for reading
StreamReader tr = File.OpenText("url.txt");
string read = null;
while ((read = tr.ReadLine()) != null)
{
Console.WriteLine(read);
}
// assign result to variable
string url = tr.ReadLine();
// close the stream
tr.Close();
//print variable contents
System.Console.WriteLine("the current url is:{0}", url);
// *** end program
So does anyone have a n idea of where i'm going wrong....the variable in
fact appears to be empty when I print its stored value. So the program is
working as such but I just cant get the data into it. I know this is sort of
over my head a little at this stage but I just wanted to have a fool
around...and I HATE when things dont work lol :)
Cheers
griff