由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - streamwriter and filestream
相关主题
[合集] 又学了一招请教个Bloomberg 的 C++ 题目
Re: [转载] how would you do this?Is the order of initialization a, b, c or c, b, a?
[合集] 被问到了这两个问题 (转载)一个c++ constructor的问题, thanks
这个python code能否优化去掉file writequestion about Design Patterns
怎么搞的?c++ question
how to write IE plug-in?what is the difference?
请教几个C++问题问个构造函数的问题
Synthesized Constructor到底什么意思?菜鸟请教smart pointer
相关话题的讨论汇总
话题: filestream话题: filename话题: using话题: write
进入Programming版参与讨论
1 (共1页)
G***G
发帖数: 16778
1
in C#, you can use StreamWriter to write a file.
and you can use Filestream and StreamWriter to do the same thing.
What is differnce between the two methds?
for example,
A)
using (FileStream fs = new FileStream(fileName,FileMode.Append, FileAccess.
Write))
using (StreamWriter sw = new StreamWriter(fs))
{
sw.WriteLine(something);
}
B)
using (StreamWriter sw = new StreamWriter(fileName, true))
{
sw.WriteLine(something);
}
d******k
发帖数: 4295
2
用FileStream catch的 exception信息更全面吧。
H****S
发帖数: 1359
3
why dont you take a look at its source code ? I think underneath, `
StreamWriter` constructor that takes file name as argument will do a
conversion to `FileStream` and call the other constructor directly ?
a9
发帖数: 21638
4
FileStream是个raw stream
StreamWriter是外面包了层壳

【在 G***G 的大作中提到】
: in C#, you can use StreamWriter to write a file.
: and you can use Filestream and StreamWriter to do the same thing.
: What is differnce between the two methds?
: for example,
: A)
: using (FileStream fs = new FileStream(fileName,FileMode.Append, FileAccess.
: Write))
: using (StreamWriter sw = new StreamWriter(fs))
: {
: sw.WriteLine(something);

1 (共1页)
进入Programming版参与讨论
相关主题
菜鸟请教smart pointer怎么搞的?
conversion(c++)how to write IE plug-in?
这样读多个文件对吗?请教几个C++问题
[转载] Re: [转载] 这样读多个文件对吗?Synthesized Constructor到底什么意思?
[合集] 又学了一招请教个Bloomberg 的 C++ 题目
Re: [转载] how would you do this?Is the order of initialization a, b, c or c, b, a?
[合集] 被问到了这两个问题 (转载)一个c++ constructor的问题, thanks
这个python code能否优化去掉file writequestion about Design Patterns
相关话题的讨论汇总
话题: filestream话题: filename话题: using话题: write