Thread: file dummy

  1. #1
    Unregistered
    Guest

    file dummy

    When reading from a file and then sorting, are u supposed to enter a few dummy values?

    What i mean to say is, if i have to read a file into a linked list and then sort the file based on certain criteria, do i have to make dummy values to initialise the list?

  2. #2
    Registered User Zeeshan's Avatar
    Join Date
    Oct 2001
    Location
    London, United Kingdom
    Posts
    226
    Your question is not at all clear...

    Still, most probably the answer is no. Why would need any dummy values ? Where'd you get that idea ?
    Last edited by Zeeshan; 06-04-2002 at 11:01 PM.

  3. #3
    Unregistered
    Guest
    I've seen a sample program where a file has to bve read into a linked list and the programmer used dummy values and i just wanted to know if they were necessary or not. I guess that its not a big thing but if anyone does know anything reply

  4. #4
    Unregistered
    Guest
    I just tried the code without a dummy value and i got a segmenatio fault. I guess that u do need to have dummy values of some sort.

  5. #5
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    What are these dummy values and where are you using them???

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    19
    these dummy values go something like this...


    Lets say i want to read in a file with this format

    "number name rate"

    then a procedure just initialises this list by adding dummy values like:

    "-1" "" "0.0"

    This is done before the file is actually read in to the linked list. I beleive that it is done to initialise the linked list

  7. #7
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Sometimes a dummy node is put in front of a list. This is to prevent from having an empty list and it can be useful having a fixed root. For example when sorting the list and the first node must be replaced. When having a fixed root, it is the second note and you can keep the root-pointer to just the first node.

    >When reading from a file and then sorting, are u supposed to
    >enter a few dummy values?

    No, that is not necessary.

    >I just tried the code without a dummy value and i got a
    >segmenatio fault. I guess that u do need to have dummy values
    >of some sort.

    I think it is implementation dependent. If the program expects dummy initialisation values, then it might crash or exit if it doesn't find it. Take a look at how the list is initialised and how initialisation is related to the file. I think that will provide the answer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  2. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  3. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  4. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM