File handling

This is a discussion on File handling within the C Programming forums, part of the General Programming Boards category; HI, Can anyone help me by giving some websites where I can find C programs that have file handling like ...

  1. #1
    Unregistered
    Guest

    File handling

    HI,

    Can anyone help me by giving some websites where I can find C programs that have file handling like add,edit,delete of records being stored in a txt file.

    I will really appreciate if you can give me some as a reference for my projects.

    Thanks
    cuteguy

  2. #2
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Tried searching for some. Couldn't fine any......may be better off writing ur own.....

  3. #3
    Registered User heljy's Avatar
    Join Date
    Mar 2002
    Posts
    36
    Guess you can do that by using:

    fopen, fclose, fgets, fprintf.
    If only life is as easy as C...

  4. #4
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    yea but those are standard functions, not what he meant. He wants more advanced ones like updating and creating records.

    Unregistered, ar u looking to stuff data in a specific file format or what/

  5. #5
    Unregistered
    Guest
    Hi Nutshell,

    Im just looking for sample application as a guide to my project. The data is to be added to a text file.

    with the format :

    lastname firstname mi age status sex .....


    Thanks

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >I can find C programs that have file handling like add,edit,delete
    >of records being stored in a txt file.
    You can try www.planet-source-code.com, but the most common way records are added is to use a temporary file to insert the data properly or use a binary tree so that when you insert the data it is already sorted and you can then write it to file (this is usually done in blocks for larger files). To delete you use a similar process by finding the record and either writing over it directly or using the temporary file method or binary tree method. What you use depends on what kind of speed you need as well as how much risk you can take and how the data is formatted.

    Editing records can be handled much the same way, see a pattern forming? This way you can reuse code written for other purposes and modularize your programs to be more productive.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating File Handling Functions
    By td4nos in forum C Programming
    Replies: 6
    Last Post: 06-26-2009, 11:43 AM
  2. basic file handling problem
    By georgen1 in forum C Programming
    Replies: 4
    Last Post: 03-05-2009, 05:21 AM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21