Sunday, 15 September 2013

c - overwriting a specific line on a text file? -


How do I write a specific file on a specific line in C.? I have values ​​in many variables that need to be written on the file.

This works only when the size of the new line is the same:

< Ul>
  • Open the file in a +
  • fseek () to start the file
  • Next line Before reading, use ftell () to keep the beginning of the line in mind
  • Read the line
  • Li>
  • If you want to Line, then use ftell () and fwrite () with the result from fseek () overwrite it
  • If line length changes, then you should make a copy of the file.


    No comments:

    Post a Comment