1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

C: Question on file handling

  1. Nov 7, 2015 #1
    1. The problem statement, all variables and given/known data
    How to delete specific record from a text file by some field from struct?

    2. Relevant equations
    -File handling
    -Searching algorithms

    3. The attempt at a solution
    I know that one of the searching algorithms is needed, but could someone explain how to
    delete found record from file?
     
  2. jcsd
  3. Nov 7, 2015 #2

    Mark44

    Staff: Mentor

    Here's what I would do:
    While the applicable field is not found:
    1. Read each record from the file into memory.
    2. If the field you're looking for does NOT match the value you're looking for, write the record to the file; otherwise (not a match) don't do anything.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: C: Question on file handling
  1. C++: File I/O (Replies: 1)

Loading...