Help implementing file modifcation algo.
Hello i m relatively new to programming and i want to implement the following algorithm.
1. accept the directory path at command prompt
2. open the directory and scan it for files of my interest (.drg)
3. when the matching file is found scan it untill the @ character is found at newline.
4. remove that whole line untill the EOF and save the file.
So far i have successfuly coded the first 2 steps and also i can detect if the matching file ( with extension .drg ) is found but i cant figure out how to proceed. I would like to know the functions matching best for my need and i would try to code the next steps myself , as that will give me some good practice.
And i have one more question :
what is the best way to modify the file and save it ?
I guess , for my specific task i willl have to copy all the contents untill newline and @ character is found and save it to another temp file. Then delete the original file and rename temp file to original filename . Is this approach the best ?
Edit : forgot to add my working environment ..which is DOS from XP and i m using Dev cpp as my compiler .