修改/写入文本文件作为嵌入式资源 [英] Modified/write text file as Embedded resources
本文介绍了修改/写入文本文件作为嵌入式资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将文本文件作为嵌入式资源写入或修改为文本文件
我可以通过以下方式轻松读取文件:
字符串txt1 = Namespace.properties.Resources.TextFile1; //将返回.txt文件的全文.
那么如何作为嵌入式资源写入文本文件?
How to write or Modified Write to Text File as Embedded Resource
I am able to read the file easily through:
string txt1 = Namespace.properties.Resources.TextFile1; // it will return whole text of .txt file.
So How to Write into Text File as Embedded Resource?
推荐答案
这是您想要的吗?
http://msdn.microsoft.com/en-us/library/system.io. streamwriter.aspx [^ ]
is this what you want?
http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx[^]
StreamWriter SW;
SW = File.CreateText("textfile.txt");
SW.WriteLine("line1");
SW.Close();
如果资源名称为Servers
,则使用以下
If the resuurce name isServers
then use the following
Dim sLine As String
sLine = My.Resources.Servers.ToString
Dim sw1 As IO.StreamWriter = New IO.StreamWriter("C:\myRec.txt")
sw1.Write(sLine)
sw1.Close()
这会将文本文件保存到"C:\myRec.txt"
This will save the text file into "C:\myRec.txt"
这篇关于修改/写入文本文件作为嵌入式资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文