deleting file contents??

masj78

Active member
Joined
Aug 8, 2003
Messages
31
Location
Harrogate, UK
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:
 
How are you storing and saving the settings? Serialization? A
strongly-typed DataSet? Manipulation of an XmlDocument object?
Something else?
 
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.
 
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 dont like using the registry to store trivial program specific info.
 

Similar threads

T
Replies
0
Views
567
This_display_name_is_already_in_use_They_all_are
T
Back
Top