|
-
Nov 21st, 1999, 06:36 PM
#1
Thread Starter
New Member
Hi everybody,
do you guys know how to use VB6 to read certain amount of characters from a textfile with a lot of characters in single line ? for example: a text file with 10,000 characters in single line and I want to get the first 1,000 characters only. if this way can be done in VB6 that could you please show me how to get subsequent characters in 1,000 character per read.
thanks.
-
Nov 21st, 1999, 07:20 PM
#2
Open the file binary, preallocate a string and loop until you reach the end.
Code:
Dim iFileNummer As Integer
Dim lPos As Long
Dim sInput As String
Dim sTotal As String
iFileNummer = FreeFile
Open "C:\MyLargeFile" For Binary As #iFileNummer
For lPos = 1 To LOF(iFileNummer) Step 1000
sInput = Space(1000)
Get #iFileNummer, lPos, sInput
sTotal = sTotal & sInput
Next
Close #iFileNummer
Hope it helps.
------------------
Vincent van den Braken
EMail: [email protected]
ICQ: 15440110
Homepage: http://www.azzmodan.demon.nl
-
Nov 22nd, 1999, 04:31 AM
#3
Hyperactive Member
hi!
In C you can assign a length to a string. If you can do that somehow in vb, then you could set the length to 1,000 and then get that var from the text file. I've never tried this, but maybe it works.
Regards,
Alexander McAndrew
VB Zone http://gsenterprise.server101.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|