473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

reading and opening textfile.. Need help...

10
Hi,

I am trying to access a text file in vb6, well I have accessed it but it gives me per line result. I need the exact character given a specific position. Is there any way to access the file and return values per character???

Thanks in advance =)
Dec 19 '07 #1
6 1198
Killer42
8,435 Expert 8TB
I am trying to access a text file in vb6, well I have accessed it but it gives me per line result. I need the exact character given a specific position. Is there any way to access the file and return values per character?
Yes. Open the file For Binary rather than For Input. Then use the Get statement to read from it. You can specify the location to read, or it will just continue from where it's up to. The size of the variable you read the data into will determine how much it reads. So if you define a variable as String * 1 for example, you can read one byte at a time.
Dec 19 '07 #2
lotus18
866 512MB
Hi there

Click this link click me. Hope you can get your answer here.

Rey Sean
Dec 19 '07 #3
rizzie
10
Yes. Open the file For Binary rather than For Input. Then use the Get statement to read from it. You can specify the location to read, or it will just continue from where it's up to. The size of the variable you read the data into will determine how much it reads. So if you define a variable as String * 1 for example, you can read one byte at a time.
Thanks for the quick response... But I do have additional questions.. Can I use Binary File Access given a specific line. To explain it further here is the scenario:

I have this text file...
H5J0001T20071127 -2 0
1BAGICN2101500015063190101500150
SBAGICN01
2 Y 01500000000000000000000000000000
4 Y0000000000000000000000000000000011
H5J0001T20071129000C0
1BAGICN4101500015063190101500150
SBAGICN01

I need to read the line with H as the first character. With that specific line I need to extract the data by reading the character with a given position..
I really appreciate your help... again thank you...
Dec 19 '07 #4
Killer42
8,435 Expert 8TB
Oops. Forget binary mode.

Just read line by line, and use the Left() and/or Mid() functions to pull the desired characters out of the text.
Dec 19 '07 #5
rizzie
10
Oops. Forget binary mode.

Just read line by line, and use the Left() and/or Mid() functions to pull the desired characters out of the text.
Ahhh.. yeah. How come I didn't think of that solution? Hehehehe. Thanks for the help...=)
Dec 19 '07 #6
Killer42
8,435 Expert 8TB
Ahhh.. yeah. How come I didn't think of that solution? Hehehehe. Thanks for the help...=)
Give it a couple of years - experience makes the difference.

We're always glad to help around here. :)
Dec 19 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Suchi | last post by:
Hi all: I want to read a textfile from an ASP program. My program is like this: Set fso = CreateObject("Scripting.FileSystemObject") workFile=http://localhost/Readme.txt) Set textFile =...
2
by: BjoernJackschina | last post by:
Hello, I just look for a capability to sort several words in view of alphabet. An example: stop is 'opst' reach is 'aechr' This should read in a new file so that I can look for same letter...
1
by: mr_ocp | last post by:
Hi friends I need routines to create an excel file with worksheets for each customer and a text file as well for each customer, first worksheet would be a "Summary Report", here is the code that...
2
by: chris | last post by:
Hi there, I am reading in a textfile which looks like this (there is no new line after the last number) 03 98661881 0407 566453 The code to load the textfile looks like this:
16
by: iwdu15 | last post by:
how can i open a file i saved and place the info into different text boxes?
2
by: novacreatura | last post by:
Hi, I have a project that's supposed to create a program for a "Dating Service". The first part of the program is to read a textfile of profiles which include names, age, etc...into a string...
1
by: Justin Fancy | last post by:
Hi everyone, I have a textfile which I need to read and compare dates. The text file summarizes every time I do an update to an internet site. Sample output is as follows: Copying...
6
by: =?Utf-8?B?UmljaA==?= | last post by:
'--this code works but only reads text into one column when contains multiple cols Dim ds1x As New DataSet Dim ConStr As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;Data...
0
by: rizzie | last post by:
Hi, I am trying to access a text file in vb6, well I have accessed it but it gives me per line result. I need the exact character given a specific position. Is there any way to access the file and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.