文件操作

1.文件夹是否存在

  if(!Directory.Exists(path))

{

    Directory.CreateDirectory(path);

2.文件的写入

using( FileStream fs   = new FileStream(fullpath,FileMode.CreateNew))

{

  byte [] data  = Convert.FromBase64String(str);

  fs.Write(data,0,data.Length);

  fs.Flush();

  fs.Close();

3.当前文件的路径

  string path =  Directory.GetCurrentDirectory();

posted @ 2011-03-24 21:46  eric john  阅读(199)  评论(0编辑  收藏  举报