[nfbcs] Reading text files c# and exceptions

jldail13 at gmail.com jldail13 at gmail.com
Tue Dec 13 02:45:00 UTC 2016


Hi,
I need to read the text file line by line.
How do I do that?


Each question will be on a separate line, with multiple choice answers.
How did you use mono?
Thanks,
Jessica


Sent from Mail for Windows 10

From: Mike Gorse via nfbcs
Sent: Monday, December 12, 2016 6:32 PM
To: Taylor Arndt via nfbcs
Cc: Mike Gorse
Subject: Re: [nfbcs] Reading text files c# and exceptions

Hi Taylor,

What exception are you getting? I just compiled your code (using mono, 
which may or may not make a difference) and got a couple of warnings about 
unused variables, but, anyhow, I created a test file and ran the compiled 
program, and it did what it is supposed to do (print a line of text, then 
ask for input).

-Mike

On Sun, 11 Dec 2016, Taylor Arndt via nfbcs wrote:

> Hi,
> So i am trying to read a file and i get a exception when  i am doing it
> using System;
> using System.IO;
>
> namespace text_file_reading_practice
> {
>    class Program
>    {
>        private static object file;
>        private static object reader;
>
>        static void Main(string[] args)
>        {
>
>            string line;
>            using (StreamReader reader = new
> StreamReader("TriviaGameQuestions.txt"))
>            {
>                line = reader.ReadLine();
>            }
>            Console.WriteLine(line);
>
>        Console.ReadLine();
>
>        }
>
>
>
>    }
> }
>
>
> -- 
> Taylor
>
> _______________________________________________
> nfbcs mailing list
> nfbcs at nfbnet.org
> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
> To unsubscribe, change your list options or get your account info for nfbcs:
> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/mike%40straddlethebox.org
>

_______________________________________________
nfbcs mailing list
nfbcs at nfbnet.org
http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
To unsubscribe, change your list options or get your account info for nfbcs:
http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/jldail13%40gmail.com




More information about the NFBCS mailing list