C# Visual Studio 2005中用FileStream将一个文件中的内容读取出来并赋给一个变量
string password = "", ch;
int a = 0;
FileStream MyFile = new FileStream(folderPathAndFolderName + "/" + "word.data",FileMode.Open,FileAccess.Read);
a = MyFile.ReadByte();
while (a != -1)
{
ch = ((char)a).ToString();
password = password + ch;
a = MyFile.ReadByte();
}
MyFile.Close();
string password = "", ch;
int a = 0;
FileStream MyFile = new FileStream(folderPathAndFolderName + "/" + "word.data",FileMode.Open,FileAccess.Read);
a = MyFile.ReadByte();
while (a != -1)
{
ch = ((char)a).ToString();
password = password + ch;
a = MyFile.ReadByte();
}
MyFile.Close();