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
去下 ......
SHIFT加F10与那个键右ctrl边上的那个键功能一样,想屏这个
但不知要怎么写那个组合键!
有没哪个大侠放一段这个的代码或写一段
http://topic.csdn.net/u/20090609/15/7dc9fb70-243f-4070-9cfd-34e48b66e6c6.html
......
现在需要在一个嵌入式系统中实现时间函数,编译器未提供time库函数,请问大家如何用c语言实现时间函数啊?
年月日时分秒 到 整数秒(从1970年开始) 之间的相关转换啊
类似mktime 和localtime的功能,谢谢
mktime ......