Solved

rewind a file

Posted on 1998-10-05
4
966 Views
Last Modified: 2011-09-20
I want to rewind a file to the beginning.  Is there a command equivalent to the rewind command in C for VB.  If not, without closing the file and opening it again, how would one do this?
0
Comment
Question by:LJ083198
  • 2
4 Comments
 
LVL 1

Expert Comment

by:steve06
Comment Utility
LJ,

What you could do is to open the file with the mode "Binary" (Open FileName.txt for Binary ), and then use the command Get to restart from the beginning of the file.

BTW, I don't see what's wrong with closing a file and reopening it right away ...

Steve.
0
 

Author Comment

by:LJ083198
Comment Utility
Because I have to bounce each record in the file off of this other file and there are 2,000 records.  It seems to take longer when i close and reopen for each record.
0
 
LVL 12

Accepted Solution

by:
mark2150 earned 20 total points
Comment Utility
If the records are fixed length and you know the record number you can use the SEEK command to reposition the pointer in the file without having to close & reopen. Will be *MUCH* faster esp if disk file can be cached.
0
 
LVL 12

Expert Comment

by:mark2150
Comment Utility
BTW: SEEK to 0 will rewind the file if you need to do a sequential search.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now