Results 1 to 2 of 2

Thread: How to save and load a text file?

  1. #1

    Thread Starter
    Addicted Member NinjaNic's Avatar
    Join Date
    Dec 2013
    Location
    Earth
    Posts
    230

    Question How to save and load a text file?

    Can someone please show me the code and/or briefly describe to me how to create a text file and write in it and save it? And also for opening a file to view or edit it? Thanks!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: How to save and load a text file?

    The details vary depending on exactly what you want to do but the simplest option is to call File.WriteAllText to write a single String to a file, creating it if it doesn't exist or overwriting it if it does. Likewise, File.ReadAllText will read the entire contents of a file into a String, with which you can then do as you like.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width