masj78 Posted September 8, 2003 Posted September 8, 2003 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: Quote
Administrators PlausiblyDamp Posted September 8, 2003 Administrators Posted September 8, 2003 would just deleting the file before saving not work? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
*Experts* Bucky Posted September 8, 2003 *Experts* Posted September 8, 2003 How are you storing and saving the settings? Serialization? A strongly-typed DataSet? Manipulation of an XmlDocument object? Something else? Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
masj78 Posted September 9, 2003 Author Posted September 9, 2003 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. Quote
Raven76 Posted October 29, 2003 Posted October 29, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.