using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Web.HttpContext.Current.Server.MapPath; namespace 追加文件删除文件
{
class Program
{
static void Main(string[] args)
{
// C#追加文件
StreamWriter sw = File.AppendText(Server.MapPath(".") + "\\myText.txt"); //这里有问题???
sw.WriteLine("追逐理想");
sw.WriteLine("kzlll");
sw.WriteLine(".NET笔记");
sw.Flush();
sw.Close(); }
}
}麻烦大家给我看看啊,哪里有问题,命名空间还是server.mappath那里有问题,谢谢了
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Web.HttpContext.Current.Server.MapPath; namespace 追加文件删除文件
{
class Program
{
static void Main(string[] args)
{
// C#追加文件
StreamWriter sw = File.AppendText(Server.MapPath(".") + "\\myText.txt"); //这里有问题???
sw.WriteLine("追逐理想");
sw.WriteLine("kzlll");
sw.WriteLine(".NET笔记");
sw.Flush();
sw.Close(); }
}
}麻烦大家给我看看啊,哪里有问题,命名空间还是server.mappath那里有问题,谢谢了
解决方案 »
- OpenXML操作Excel提示SharedStringTablePart序列为空
- 使用过spread for winform控件的兄弟们请进
- 线程的进度显示问题
- 求助,如何通过c#获取和管理AD LDS(Active Directory 轻型目录服务)的ACL?
- 如何移动无边框的窗体?
- 如何读取后缀为eml格式的邮件内容和地址(已经在本地)
- 请问有没有对LISTBOX的自动排序方法?
- ADO.NET中如何把数据库中表的约束条件(如外键等)传入DataSet中
- 大散200分!感情复杂!斧头走了思归来了,,!!!今天才发现的。。。。要分的人进来接吧。。给200,,,UP的有分
- 文件传输怎么穿过防火墙?
- 有研究enterprise library的吗?
- DataGrid中内容生成到XML的问题
如果你要取得当前程序执行的目录,请使用 AppDomain.CurrentDomain.BaseDirectory属性
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Web.HttpContext.Current.Server.MapPath; namespace 追加文件删除文件
{
class Program
{
static void Main(string[] args)
{
// C#追加文件
StreamWriter sw = File.AppendText(Application.StartupPath+ "\\myText.txt"); //这里有问题???
sw.WriteLine("追逐理想");
sw.WriteLine("kzlll");
sw.WriteLine(".NET笔记");
sw.Flush();
sw.Close(); }
}
}