C# 菜鸟继续提问! - .NET技术 / C#
做个小东西,运行过程中会得到一个int数据,我想把这个数据另存为问题,下次该程序再运行时可以使用!XML,TXT等都行!怎么生成,生成了怎么更新,怎么读取!相对路径!
你放到本地的一个txt文件里,程序关闭时把该文件打开,更新,程序开启式打开读取
如果就只有个数据的话,那就存个txt吧。
web:
写:
using (StreamWriter sw = File.CreateText(Server.MapPath(相对路径)))
{
sw.WriteLine("Hello");
sw.WriteLine("And");
sw.WriteLine("Welcome");
}
读:
using (StreamReader sr = File.OpenText(Server.MapPath(相对路径)))
{
string s = "";
while ((s = sr.ReadLine()) != null)
{
Console.WriteLine(s);
}
}
up
关闭时更新
C# code:
// it will be done when the form close.
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
FileStream file = File.Open(@"C:\dataBegin.txt", FileMode.Open);
StreamWriter sWriter = new StreamWriter(file);
//change the record in the file.
sWr
相关问答:
DataSet导出xml 批处理(循环)得怎么处理
XML文件
<A>
<B>
<C>
</C>
&nb ......
我这里有一个登陆WIFI网络的页面。由于WIFI经常断线,所以要反复地在这个网页上登陆,没法无人值守。
所以,我想做一个C#程序,放一个webbrowser控件,自动填表并自动点击提交按钮。
问题一:
基本照网上找的程序 ......
可能因为工作的原因 接触数据库这块比较少,之前都是做程序这块,数据库这块都有专门的人来做 分工都很明细 所以对数据库这一块完全不了解。前段时间 去面试了几家公司 几乎都是在数据库这块挂掉的 连个简单的SQ ......
我只学过清华蓝封面的C语言基础,想更深入的学习,该看什么书好?
C Primer Plus
C程序设计语言(第2版新版)
C语言程序设计_现代方法
C语言参考手册第五版
C语言大全
C和指针
C陷阱与缺陷
C专家编程
......
帮帮忙,谢谢~
1. Write a program to perform a topological sort on a graph.
2. Write a program to solve the single‐source shortest‐path problem (Dijkstra
algorithm).
3. Write a program ......