VB.net中的StreamWriter(附加) [英] StreamWriter (Append) in VB.net

查看:1070
本文介绍了VB.net中的StreamWriter(附加)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我再次询问这个问题,如果后者不存在,在StreamWriter中添加Append是否还可以创建一个文本文件?

这是我的代码如下:

Ok, I''m asking again this question, does Append in StreamWriter also can create a text file if the latter does not exist?

Here is my code below:

推荐答案

存在的解决方案:首先创建System.IO.FileStream的实例,然后基于该流创建System.IO.StreamWriter.

完整的代码示例如下所示:
http://msdn.microsoft.com/en-us/library/system.io. filestream.aspx [^ ](您可以搜索添加"以查看此位置).

—SA
The solution exist: you first create an instance of System.IO.FileStream and then create a System.IO.StreamWriter based on that stream.

The complete code sample is shown here:
http://msdn.microsoft.com/en-us/library/system.io.filestream.aspx[^] (you can search for "Append" to see this place).

—SA


在一般场景中,如果StreamWriter处于追加模式时不存在,则它将创建新文件.
In general scenerio, StreamWriter will create new file if it doesn''t exist when it is in append mode.


这篇关于VB.net中的StreamWriter(附加)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆