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
相关问答:
写了个测试程序如下
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
最近在做个网上商城,购物车模块,没有做过,麻烦各位帮忙说下大致说下思路,能发一份源码更好。小弟先谢过各位了;
QQ:413763818;
eamil:swebook@126.com
网上一大堆!
www.51aspx.com
去下 ......
txt 和XML 格式相应
不借助DataSet
导入读取TXT文件
然后直接写入XML(同一文件,不同数据,递增原数据没有被覆盖情况下增加数据.)
教个要点或最好是有个代码提示的
过路好汉 帮个忙撒^^
不会,帮楼主 ......
我只学过清华蓝封面的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 ......