• Create Account

### #Actualbrx

Posted 23 January 2013 - 06:20 AM

Judging by the question, you do not only want to read a line from a file, but also write it, right?

Writing:
TextWriter writer = new StreamWriter("settings.dat");
writer.WriteLine(colorId);
writer.Close();

TextReader reader = new StreamReader("settings.dat");

Note that you also should do some error checking, right now bad things will happen if, for example the file cannot be opened or the file does not have two lines in it...

### #1brx

Posted 23 January 2013 - 06:19 AM

Judging by the question, you do not only want to read a line from a file, but also write it, right?

Writing:

TextWriter writer = new StreamWriter("settings.dat");
writer.WriteLine(colorId);
writer.close();
TextReader reader = new StreamReader("settings.dat");
reader.Close();