Results 1 to 5 of 5

Thread: forward and bak in the file

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Unhappy forward and bak in the file

    Hi

    Is there some function that gets to go forward and back in a file?


    thank you in advance
    Attached Files Attached Files

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Why dont you just read the entire file into memory and then do whatever you want to it.

  3. #3

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    file is very much big

    Hi

    The file is very great

  4. #4
    jim mcnamara
    Guest
    The file pointer is the position in the file where the next read (or write) will take place. The SEEK statment changes the file pointer.

    If all the records are the same size, use RANDOM access and SEEK a particular record.



    Code:
    'Random access file -- each record is the same size.
    
    Dim MyRecord as string * 40 
    ' Open file in random-file mode.
    Open "TESTFILE" For Random As #1 Len = Len(MyRecord)
    MaxSize = LOF(1) \ Len(MyRecord)   ' Get number of records in file.
    ' read in backwards
    For RecordNumber = MaxSize To 1 Step - 1
       Seek #1, RecordNumber
       Get #1, , MyRecord  
    Next RecordNumber
    Close #1   
    
    
    'Reading a text file
    
    Open "TESTFILE" For Input As #1
    MaxSize = LOF(1)   ' Get size of file in bytes.
    ' this code reads the file backwards
    For NextChar = MaxSize To 1 Step -1   
       Seek #1, NextChar   ' Set position.
       MyChar = Input(1, #1)   ' Read character.
    Next NextChar
    Close #1   ' Close file.

  5. #5

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Talking How I read backward ?

    Hi

    thanks, but how do I read backward, I read 20 bytes and want backward 5 bytes ?

    thanks

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