本文介绍了请帮助FileStream阅读.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void Login_btn_Click(object sender, EventArgs e)
{
User u1 = new User();
u1.Username = Username_login_Textbox.Text;
u1.Password = Password_login_Textbox.Text;
FileStream fs1 = new FileStream(@"C:\Users\QEBO\Desktop\Exam_System_Users\test.txt", FileMode.OpenOrCreate, FileAccess.Write);
BinaryReader br = new BinaryReader(fs1); // here appears THE STREAM WAS NOT READABLE :(
if (u1.Username == fs1.Length.ToString())
{
if (u1.Password == fs1.Length.ToString())
{
ExamSystem es = new ExamSystem();
es.ShowDialog();
}
}
else
{
MessageBox.Show("Invalid username or password");
}
fs1.Flush();
fs1.Close();
br.Close();
}
推荐答案
FileStream fs1 = new FileStream(@"C:\Users\QEBO\Desktop\Exam_System_Users\test.txt", FileMode.OpenOrCreate, FileAccess.Read);
BinaryReader br = new BinaryReader(fs1);
这篇关于请帮助FileStream阅读.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!