Tuesday, July 14, 2009

What is the function in c language to delete a line from text file??

There is no such function in the standard C library.





Open the file for reading


Open an output file for writing.


Read the first file, line at a time. If it's not the line you want to delete, write the line to the output file.


Close both files.


Change the name of the first file to something else.


Change the name of the second file to the original name of the first file.


Then and ONLY then is it safe to delete the original file.


No comments:

Post a Comment