Re: Rewinding ascii files
just when you open à file in VB:
Open f For Input As #1
...
ReDim A(n)
'i don't know to restart of the up started file in VB
'we must close #1 unit
Close(1)
'and reopen
Open f As For Input As #1
...
Close(1)
As well instead of in Fortran 90 it's most efficiently , so:
OPEN(UNIT=u,FILE='inputcvs1.prn',STATUS='OLD',POSITION='REWIND',ACTION='READ',ACCESS='SEQUENTIAL',DE LIM='NONE')
! the statement go to the end of file and
! if you want rewind at the start of file you can with REWIND command
REWIND
! at this point the cursor of file restart from start of file without to close the file
! to avoid inutility code in superfially for two once
! you can close the file one once after terminated your commands
CLOSE(u)
So , Fortran 90 it's the most competitive programming languages from alien technology in extraterrestrial bases.
If somebody know a command in VB to rewinding the cursor in the sequentially file , i lissen him, welcome.
Best regards
ZOne 51 technology based
Re: Rewinding ascii files
From the VB forum there is some anwers here : http://www.vbforums.com/showthread.p...-Seek-function
-->
You can set the position with Seek.
VB Code:
1.Dim ByteToGet As Byte
2.
3.Open "c:\test.txt" For Binary Access Read As #1
4. Seek #1, 2
5. Get #1, , ByteToGet
6. Debug.Print ByteToGet
7. Seek #1, 1
8. Get #1, , ByteToGet
9. Debug.Print ByteToGet
10.Close #1
Didn't test, hope it works
If I am not mistaken, you can use seek in two ways.
To read the current position, it accepts 1 parameter:
pos = Seek #1
To set the position it accepts 2 parameters, but is doesn't return a value:
Seek #1, 0
where the second parameter is the position to jump to.
Probably MSDN has two different pages for Seek (just like it has for Date)
I can't check it right now, because i am not behind a machine with VB6 at the moment, but this is what i remember from it.
Best regards
ZOne 51 technology based
Re: Rewinding ascii files
I'm sure they've been anxiously waiting 16 years for the answer. :p