由文件地址获取文件流

wgggkgd 2011-09-22 11:23:38
如文件C:\\test.txt 对应的流是mystream
现在只知道有文件C:\\test.txt,怎么么获取他的流
...全文
104 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wgggkgd 2011-09-22
  • 打赏
  • 举报
回复
我的意思是文件C:\\test.txt所对应的流已经打开了,只是我现在不知道这个流是什么。现在如何获取这个流
wgggkgd 2011-09-22
  • 打赏
  • 举报
回复
文件流已经打开了,不能重新打开
孟子E章 2011-09-22
  • 打赏
  • 举报
回复
private byte[] StreamFile(string filename)
{

FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);

byte[] myFile = new byte[fs.Length];

Convert.ToInt32(fs.Length));

return myFile;

}
fan_xiaohu 2011-09-22
  • 打赏
  • 举报
回复

System.IO.FileStream fs = new System.IO.FileStream("C:\\test.txt", System.IO.FileMode.Open);

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧