Results 1 to 10 of 10

Thread: Questions for text files!

  1. #1

    Thread Starter
    Lively Member James Bond 007's Avatar
    Join Date
    May 2000
    Location
    London
    Posts
    116
    I have questions for text files!

    1. What are the major differences between Random and Binary. If using Random to manipulate as a database, how can I tell the number of records in a text file?

    2. For Lock, what is SHARED, LOCK READ, LOCK WRITE, LOCK READ WRITE?
    License to Program

    007

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Random opens with fixed length records, and your file needs to be formatted according to a pattern. Using Binary you can read and write stuff more freely, put several headers, footers, and data suiting your needs.
    Lock means when you open the file,
    Shared > it can be opened by other open statements but not be deleted
    Read > can't be read but written to
    Write > can be read but not written to
    read write, can't be opened at all.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guest
    I remember there was an article on this site about different access modes. I'll if I can find it for you.

  4. #4

    Thread Starter
    Lively Member James Bond 007's Avatar
    Join Date
    May 2000
    Location
    London
    Posts
    116
    Thanks for going the distance Megatron. I wish I can help you guy back.


    Kedaman, thanks for your effort. You explained alot of stuff to me in the past.
    License to Program

    007

  5. #5

    Thread Starter
    Lively Member James Bond 007's Avatar
    Join Date
    May 2000
    Location
    London
    Posts
    116
    How can I find the total number of records in an existing random file?
    License to Program

    007

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    by integer division

    Recs=lof(filenumber)/Reclen
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7

    Thread Starter
    Lively Member James Bond 007's Avatar
    Join Date
    May 2000
    Location
    London
    Posts
    116
    Kedaman,

    I am using this code right now. I is placing the next record on the same line. How can I make each record on a new line.


    Dim LastRecord As Integer
    Open "C:\HHH.txt" For Random Access Read Write As #1 Len = Len(MyWorker)
    LastRecord = LOF(1) / Len(MyWorker) + 1
    Put #1, LastRecord, MyWorker
    License to Program

    007

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    i'm not sure if this works with random access, at least it does with binary, that it automatically moves the location one step forward and write the current record by omitting the record#

    Put #1, , MyWorker
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9

    Thread Starter
    Lively Member James Bond 007's Avatar
    Join Date
    May 2000
    Location
    London
    Posts
    116
    Is there a way to delete a record Kedaman?
    License to Program

    007

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Of course it is, but how hard depends on how you want to delete it.

    1. just reset the record data
    2. shuffle the following data one step left
    3. move the last record into the just removed item.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width