Thread: can someone give me a brief explanation of random and sequential files??

  1. #1
    Registered User
    Join Date
    Dec 2001

    Question can someone give me a brief explanation of relative and sequential files??

    and how to go from a seq. txt file to a relative file in c++
    Last edited by pkananen; 02-10-2002 at 01:43 PM.
    I Love Jesus

  2. #2
    here's my definitions, but they may not be the same as yours.

    A sequential file is one in which data is stored in sequence. The data could be of any type; of any length, in any sequence.

    Here's an example:

    123456789 happy birthday 20.012

    here's another:

    123 345 red 001 456 blue;

    Both of the above examples are sequential. If you know the pattern you can get things out just fine. The latter file seems to have a reasonble pattern of two ints followed by a string. If you encorporated that pattern into a struct, then you could think of it as a sequence of struct. Since each struct must have the same amount of memory, then you can use random access to access any given structs contents. This latter type of file is a relative file where all data is a given multiple of memory away (relative) to any other chunk of memory. Relative files have to have memory in specific chunks, meaning same size fields for each item stored in the file. If you can find a repetitve pattern in a sequential file can convert it into a relative file.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 09-30-2008, 12:10 AM
  2. Sequential and binary files in c
    By CiaranB in forum C Programming
    Replies: 2
    Last Post: 05-08-2008, 09:26 AM
  3. sequential vs random
    By rajabadsha in forum C Programming
    Replies: 3
    Last Post: 05-09-2006, 10:50 AM