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
相关问答:
请问VFP中如何调用C/C++函数?
你要调用什么功能的函数?要看看VFP中有没有对应的函数,如果有就省着再调用了。如果没有,可以将C/C++函数写个DLL或FLL,然后在VFP调用即可。
十豆三 老师,怎么才能修改自己的 ......
txt 和XML 格式相应
不借助DataSet
导入读取TXT文件
然后直接写入XML(同一文件,不同数据,递增原数据没有被覆盖情况下增加数据.)
教个要点或最好是有个代码提示的
过路好汉 帮个忙撒^^
不会,帮楼主 ......
SHIFT加F10与那个键右ctrl边上的那个键功能一样,想屏这个
但不知要怎么写那个组合键!
有没哪个大侠放一段这个的代码或写一段
http://topic.csdn.net/u/20090609/15/7dc9fb70-243f-4070-9cfd-34e48b66e6c6.html
......
我这里有一个登陆WIFI网络的页面。由于WIFI经常断线,所以要反复地在这个网页上登陆,没法无人值守。
所以,我想做一个C#程序,放一个webbrowser控件,自动填表并自动点击提交按钮。
问题一:
基本照网上找的程序 ......
帮帮忙,谢谢~
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 ......