if (myFile.Exists == false)
{
myFile.Create().Close();
}
{
myFile.Create().Close();
}
解决方案 »
- 着急:解析NETCDF格式数据时,调用C++原生DLL,取数据报异常
- 如何禁用应用程序的多重启动
- 怎样获取以某点为中心,圆或环上的像素值
- [C# - WinForms] 如何让透明控件的透明部分显示下层控件?
- 迅龙中文搜索 0.7 nSearch版 C# 源代码下载
- 一个对象能找到此单实例,另一个对象找不到此单实例;错误:无法访问名为"XYZ"的已处置对象
- datalist 折叠 当前上下文中不存在名称
- --- 高分求解 --- !!!请教高手!!! 如何编写强制与其他程序沟通的WIN程序 ,内详,暂时只有70分,解决后分不是问题,谢谢!
- 运算符重载的问题
- 如何编写一个解析函数?
- 我真的很笨啊,很简单的问题好几天都不会
- 关于WebBrowser显示Flash的问题
FileInfo myFile = new FileInfo(Application.StartupPath + "/logintext.txt");
if (myFile.Exists == false)
{
using (FileStream fs = myFile.Create())
{
Byte[] info = new UTF8Encoding(true).GetBytes("This is some text in the file.");
fs.Write(info, 0, info.Length);
} }
StreamReader sr = null;
sr = new StreamReader(Application.StartupPath + "/logintext.txt", System.Text.Encoding.UTF8);
string mystr = sr.ReadLine();
textBox1.Text = mystr;
sr.Close();
if (!myFile.Exists)
{
FileStream fs = File.Create(myFile.FullName);
fs.Close();
}
{
System.IO.File.Create(Application.StartupPath+@"\logintext.txt");}
FileInfo myFile = new FileInfo(Application.StartupPath + @"\logintext.txt");
FileStream fs = null;
if (myFile.Exists == false)
{
fs = myFile.Create();
}
else
{
fs = myFile.Open(FileMode.Open);
}
StreamReader sr = null;
sr = new StreamReader(fs);
string mystr = sr.ReadLine();
loginuser.Text = mystr;
sr.Close()