c# - Text file to store data -


I want to continue some data in a text file in my C # application. I added the text file to the root of my project.

How do I use it now? Does this file my exe or what? First of all, make sure that you click on the correct file and "copy in the output directory"

Second, the file will not be embedded inside your executable. It will be a normal * .txt file with your * .exe and you can access it like this:

  StreamWriter sw = null; FileInfo fi = New FileInfo (Path.Combine (application.StartupPath, "filename.txt")); If (fi.Exists) sw = new StreamWriter (fi.Open (FileMode.Open));  

Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -