Need a format to write large .dat file with numbers

Discussion in 'Questions (Windows Mobile)' started by Stellaferox, Feb 3, 2008.

  1. Stellaferox

    Stellaferox Active Member Licensed User

    Hi,

    I need the best format to write a large DAT file with numbers from a loop.

    idea:

    openfile of some sort
    For c1 = 1 to x
    For c2 = 1 to y
    For c3 = 1 to z
    Write (c1,c2,c3,c1*c2*c3) to a file in some number format
    next
    next
    next
    closefile of somesort


    In other words which keywords do I use? FilePut, FileWite etc.
    If anyone has an example I'd appreciate it very much....

    thnx

    Marc
     
    Last edited: Feb 3, 2008
  2. RandomCoder

    RandomCoder Well-Known Member Licensed User

    If it was me doing this then I'd put all the values into a table and simply save the table to CSV.
    I would think that this would be faster than writing each value to the file separately.

    Ragards,
    randomCoder
     
  3. Stellaferox

    Stellaferox Active Member Licensed User

    Yes, that would definitely be the best approach but I need 133784560 entries!
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    The best approach is to use a random access file.
    Open the file with FileOpen(c,"filename",cRandom).
    Now you have two options:
    1. Use FileGet / FilePut and save the numbers as double type (8 bytes per number).
    2. BETTER: Use BinaryFile to write and read the required types.
     
  5. Rioven

    Rioven Active Member Licensed User

    Hi guys,
    could be darn question...

    If large data will be splited in two or more data files and then do some filters in opening a necessary file where to read particular data, is it an advantage in some way or not?

    regards,
     
Loading...