sjn78 Posted May 16, 2003 Posted May 16, 2003 I need to be able to write to a specific line in a text file. I can get the line number where I want the text to go, but actually writing to that line is the problem. If anyone can help me out it would be great. Thanks Steve Quote
*Gurus* divil Posted May 16, 2003 *Gurus* Posted May 16, 2003 You must read the whole file in, change the line and then write the whole file out again. If this could cause memory problems, you can always write out the new file as you're reading the old one in on the fly. Either way, there's no way of directly replacing a line in a file. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
sjn78 Posted May 17, 2003 Author Posted May 17, 2003 Ok, I thought there was a way to loop throught the file then stop at the specific line, then change it. I am actually trying tp write an ini file, but I have read xml files are better to use know but I have no idea where to start with them. Are there any good places with examples of them to help me get started? Thanks Steve Quote
Guest mutant Posted May 17, 2003 Posted May 17, 2003 Try this: http://samples.gotdotnet.com/quickstart/howto/default.aspx?url=/quickstart/howto/doc/Xml/OverviewofXML.aspx 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.