Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi All,

 

Does anyone know if its possible to delete the contents of a text file.

I am using stream reader/writer to try and store program settings, and need some way of removing the settings already in place if the user decides to change them.

 

cheers!:confused:

  • *Experts*
Posted

How are you storing and saving the settings? Serialization? A

strongly-typed DataSet? Manipulation of an XmlDocument object?

Something else?

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted
Well I am storing ordinary text in a notepad text file. Deleting the file and re-creating it is one solution that I will try, cheers! Ideally I need to read past the file till -1 and then backupspace to the start of the file.
  • 1 month later...
Posted

Since you are storing program settings, you might be better off saving to either an .ini or .xml file. Both of these formats have a predefined structure for storing such data as well as prebuild methods for reading/writing/editing that data in .NET.

 

By saving data in your own format you might be reinventing the wheel.

 

The registry is also an option although I personally don't like using the registry to store trivial program specific info.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...