?
Solved

rewind a file

Posted on 1998-10-05
4
Medium Priority
?
981 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:steve06
ID: 1438247
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
ID: 1438248
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 80 total points
ID: 1438249
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
ID: 1438250
BTW: SEEK to 0 will rewind the file if you need to do a sequential search.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

770 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