Beginner - few examples please (stream reading/writing to text files)

Jan 20 2007 9:21 PM
I am fairly new to programming, but do understand the logic once I see it once. I am attempting to make a small utility that will help simplify a few mundane things at work I do from time to time and was hoping that someone here could give me some samples of code for the following tasks... This will be a windows app. When I open the app I will have a button, and I would like the button to do the following: Open a text file and read it line-by-line. If it finds a line that starts with "servername=(ANYTHING)" and if such a line exists, I would like for it to replace it with a new "servername=(SOMETHING ELSE ALREADY TAKEN CARE OF BY A VARIABLE I WILL SET)" line. From what I do know, I think this probably needs to involve reading the text file as a stream, and then outputting line-by-line as a stream. That's about all for now. I am sure I will have a few more questions but this app will be pretty small and only need to do a few things besides that, which is going to be the bulk of its task. Thanks! I look forward to all replies! I know my questions may sound basic but I should pick right up once I get started! Thanks! ----- Edit - I am using Visual Studio.net 2003 (also have 2005) and will most likely be using c++ or c# for this app. (I have more experience in c++ but am willing to try anything I am given code snippets for!)