473,386 Members | 1,962 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,386 software developers and data experts.

Reading Lines from a File that is in Memory

OK, based on someones ssuggestion in an earlier post I have some code
that reads a text file into memory. This is the code:

Dim FileNum As Integer
Dim TotalFile As String

Open FileName For Binary As #1
TotalFile = Space(LOF(1))
Get #1, , TotalFile

Now the data is all in my variable, TotalFile. The data is structured I
know exactly which piece was pulled in from excatly which line in the
original text file so I don't need to do any seraching or string
manipulation, I simply want to read the file in memory a line at a
time. Is this possible in the format in which I have it stored? If so,
how? If now can I accomplish this some other way?

Thanks,
John

Aug 4 '06 #1
2 821
Hello jcrouse,

Uhh.. this is a vb.net group. You'll want to try the vb6 group/s.

In .net you would create a Filestream, attach a streamreader, and call streamreader.readline.

-Boo
OK, based on someones ssuggestion in an earlier post I have some code
that reads a text file into memory. This is the code:

Dim FileNum As Integer
Dim TotalFile As String
Open FileName For Binary As #1
TotalFile = Space(LOF(1))
Get #1, , TotalFile
Now the data is all in my variable, TotalFile. The data is structured
I know exactly which piece was pulled in from excatly which line in
the original text file so I don't need to do any seraching or string
manipulation, I simply want to read the file in memory a line at a
time. Is this possible in the format in which I have it stored? If so,
how? If now can I accomplish this some other way?

Thanks,
John

Aug 4 '06 #2
Chit....sorry, my bad.

Thanks for the slap :)
John

Aug 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Alex Hopson | last post by:
I'm trying to read an html file from my local server into a string, I'm using the following code: $attfile = $attachment; //create filenames $file_name = basename ($attfile); $lines =...
3
by: Rajarshi Guha | last post by:
Hi I have a file containing 168092 lines (each line a single word) and when I use for line in f: s = s + line it takes for ages to read it all in - so long in fact that it makes the program...
6
by: Kevin T. Ryan | last post by:
Hi All - I'm not sure, but I'm wondering if this is a bug, or maybe (more likely) I'm misunderstanding something...see below: >>> f = open('testfile', 'w') >>> f.write('kevin\n') >>>...
4
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # to open a file and write to file # do f=open('xfile.txt','w') # this creates a file "object" and name it f. # the second argument of open can be
20
by: sahukar praveen | last post by:
Hello, I have a question. I try to print a ascii file in reverse order( bottom-top). Here is the logic. 1. Go to the botton of the file fseek(). move one character back to avoid the EOF. 2....
50
by: Michael Mair | last post by:
Cheerio, I would appreciate opinions on the following: Given the task to read a _complete_ text file into a string: What is the "best" way to do it? Handling the buffer is not the problem...
8
by: Andrew Robert | last post by:
Hi Everyone. I tried the following to get input into optionparser from either a file or command line. The code below detects the passed file argument and prints the file contents but the...
16
by: Ron | last post by:
Hello everyone, I've created a functioning ATM program, a bank machine. Now I want to implement usernames and Pins into it. So I have a text file with this info. BILL, 1111 TOM, 2222...
25
by: 7stud | last post by:
I can't break out of the for loop in this example: ------ import sys lst = for line in sys.stdin: lst.append(line) break
16
by: WATYF | last post by:
Hi there... I have a huge text file that needs to be processed. At the moment, I'm loading it into memory in small chunks (x amount of lines) and processing it that way. I'd like the process to be...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.