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

Start reading from 30 line

Hey
I don't know how to start reading a text file from a 30 line ? I got an idea :
For i=1 to 30
streamReader.readline()
Next

but if it would be 2000 line it won't be a robust code... Is there any
better way ?
Jarod
Nov 21 '05 #1
2 977
Use while loop.

chanmm

"Jarod" <Ja***@discussions.microsoft.com> wrote in message
news:20**********************************@microsof t.com...
Hey
I don't know how to start reading a text file from a 30 line ? I got an
idea :
For i=1 to 30
streamReader.readline()
Next

but if it would be 2000 line it won't be a robust code... Is there any
better way ?
Jarod

Nov 21 '05 #2
On Sat, 23 Oct 2004 08:47:03 -0700, Jarod wrote:
Hey
I don't know how to start reading a text file from a 30 line ? I got an idea :
For i=1 to 30
streamReader.readline()
Next

but if it would be 2000 line it won't be a robust code... Is there any
better way ?
Jarod


Is each line in the file the same length? If so, you could use the seek
method of the stream. Just calculate the position to seek to using the
following formula:

iSeekPos = (iLineNo - 1) * iLineLength

If the lines in the file are not all the same length, then you will have to
use a loop.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #3

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

Similar topics

3
by: Kangol kangoll | last post by:
hi, i've been trying to figure out how to make visual basic start extracting text at a certain line to when i tell it to stop. I am making trying to make a program where it extracts text from a...
10
by: Tony | last post by:
I am running an application called AcroComm.exe to poll time clocks here at our company. I have written a small C# app that will poll the clocks based on information found in a DB. My problem is...
9
by: Sam Marrocco | last post by:
I'm using a ProcessStartInfo object to provide command line information to a process for execution as follows: Dim PSI as new ProcessStartInfo PSI.Filename MyApp.exe PSI.Arguments -blah -blah...
8
by: Zytan | last post by:
I thought each XmlNodeType.Element has a matching XmlNodeType.EndElement. But, this does not occur when the XML file has the following: <example attr1="1" attr2="2" /> Even though this is...
5
by: jslee99a | last post by:
hello I use visual basic 6.0. I want to read file twice. First i read file then i don't know how to move the file pointer to the start point. i don't want to close file and reopen. ...
2
by: jonathan184 | last post by:
How to exclude lines from a txt file that start with a # Hi basically my script works fine. I wanted to add some comments in my config file but it is reading in the comment lines to. So...
9
by: antar2 | last post by:
I am a starter in python and would like to write a program that reads lines starting with a line that contains a certain word. For example the program starts reading the program when a line is...
1
by: Venkat143 | last post by:
Hi, I need some help with vb scripting. While setting the property of delimiters to start reading from a space of tab, i used the following code to read then write: If Variables Then ...
1
by: aberry | last post by:
I have text file which contain Unicode data (say inp.txt) I read file using following code:- import codecs infile = codecs.open('C:\\tdata\\inp.txt','r','utf-16',errors='ignore') data =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.