Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 23rd, 2004, 09:33 PM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading From A File

Hi,

I need Help in Opening and reading a data file in Binary mode. I need to open the file, read line by line and extract (for example) bytes 10 - 25 from each line (record), and then write the extracted data to another file. Can someone help me please?
Thanks

 
Old September 24th, 2004, 04:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

The concept of "lines of data" doesn't apply to binary files, there are just bytes.

You can use the ADO Stream object to read/write binary files, or the older built-in VB method of
Open <<filename>> for Binary As <<filenumber>>
combined with Get and Put to read and write the data.

hth
Phil
 
Old September 27th, 2004, 06:19 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Anantsharma Send a message via Yahoo to Anantsharma
Default

Well my friend u can think about FileSystemObject also.
Add reference to "Microsoft Scripting Runtime". U can then create Object of "FileSystemObject" which is very flexible about reading and writing data from/To files.

Hope u can dig out. If no I will give u the code. But U should go for own try.


B. Anant
 
Old September 27th, 2004, 06:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

FileSystemObject is no good for reading binary files, it's only for text files.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with PHP file reading XML file for output rydog65 Beginning PHP 0 March 26th, 2008 05:13 PM
Reading xml file which is in a JAR file pradheepayyanar J2EE 2 December 26th, 2007 05:52 AM
Reading a Text File gmoney060 Classic ASP Basics 2 October 30th, 2004 01:43 AM
reading HTML from file -> write to file mikeuk Beginning PHP 4 July 21st, 2004 05:40 AM
reading excel file msrnivas .NET Web Services 0 February 9th, 2004 06:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.