Linked Lists and File Writing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leftfootfirst
    New Member
    • Feb 2008
    • 1

    Linked Lists and File Writing

    Hi all,
    I'm just going to get right down my question since the exact program details are unnecessary and complicated.
    Basically, I have a database handler that writes to a file certain data. Since I will have to be able to remove, add, and edit each piece of data, I decided to implement a singly linked list. Each node contains the elements of data that I need.
    Now, this is where I get confused and was hoping someone could offer some advice on:
    1) First of all, how in the world can I write a linked list to a file? Is this even possible? I'm not sure I fully understand what a "file" EXACTLY is.
    2) If the above is possible, how can I access the file and thus the linked list inside of it?
    3) Should I have a separate source code for my node and list implementations ?

    Much thanks in advance!
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by leftfootfirst
    Hi all,
    I'm just going to get right down my question since the exact program details are unnecessary and complicated.
    Basically, I have a database handler that writes to a file certain data. Since I will have to be able to remove, add, and edit each piece of data, I decided to implement a singly linked list. Each node contains the elements of data that I need.
    Now, this is where I get confused and was hoping someone could offer some advice on:
    1) First of all, how in the world can I write a linked list to a file? Is this even possible? I'm not sure I fully understand what a "file" EXACTLY is.
    2) If the above is possible, how can I access the file and thus the linked list inside of it?
    3) Should I have a separate source code for my node and list implementations ?

    Much thanks in advance!

    Are you trying to maintain the linked list inside a file or the data of a file inside a linked list?
    If u want to access the data fast you can go for memory map but in that you cant delete data like a linked list

    Raghuram

    Comment

    Working...