how can i enter values in a linked list and write then to a file????

This is a discussion on how can i enter values in a linked list and write then to a file???? within the C Programming forums, part of the General Programming Boards category; i have no clue how to do this any help is greatly appreciated!!!!!!!! i need to be able to enter ...

  1. #1
    Unregistered
    Guest

    Question how can i enter values in a linked list and write then to a file????

    i have no clue how to do this any help is greatly appreciated!!!!!!!!
    i need to be able to enter 4 values 2 integers and 2 strings and put them in a linkedlist and store them in a .dat file for further use.

  2. #2
    Nit
    Nit is offline
    Registered User
    Join Date
    Mar 2002
    Posts
    42

    Re: how can i enter values in a linked list and write then to a file????

    Originally posted by Unregistered
    i have no clue how to do this any help is greatly appreciated!!!!!!!!
    i need to be able to enter 4 values 2 integers and 2 strings and put them in a linkedlist and store them in a .dat file for further use.
    Code:
    struct link {
    int val1;
    int val2;
    char *string1;
    char *string2;
    link *nextLink;
    } ;
    That's the structure you need. Now just enter values and implement it like a single linked list ( or even a double-linked list).

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    "How can I enter values in a linked list and write them to a file?"

    Well first, you enter them into a linked list...
    Then you write them into the file...

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    just use the fwrite() function.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    *smirk* Or how about that "scary" fprintf.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 03:49 PM
  2. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  3. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 09:33 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

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