Click here to Skip to main content
15,905,238 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
Posted
Updated 12-Nov-10 23:31pm
v2

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();
 
Share this answer
 
v4
Comments
InvXeesh 13-Nov-10 5:34am    
I am talking about to write into text file as embedded resource. I have a file as Embedded Resource in Project.
your method is for general file writing.
euhiemf 13-Nov-10 5:38am    
ok, http://www.codeproject.com/KB/dotnet/embeddedresources.aspx maybe?
If the resuurce name is Servers then use the following

VB
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()


This will save the text file into "C:\myRec.txt"
 
Share this answer
 
Comments
Toli Cuturicu 13-Nov-10 10:50am    
What language is that? Certainly not c# (as in the question's tags)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900