473,480 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

readline

i've opened a text file, say config.ini and it contains 3 lines

config.ini
' this is a test file
mypath=c:\abc
mybatch=c:\batch\runme.bat

1. How do i use readline method to ignore anything that has 'comments ?

2. What is the best way to read those those variables from mypath and
mybatch ? I can use a do loop, how do i pass c:\abc and c:\batch\runme.bat
into different variables as i execute the programs ?


Nov 21 '05 #1
3 1958
Hi,

http://www.mentalis.org/soft/class.qpx?id=6

Ken
-------------
"James" <jk****@hotmail.com> wrote in message
news:ue**************@TK2MSFTNGP14.phx.gbl...
i've opened a text file, say config.ini and it contains 3 lines

config.ini
' this is a test file
mypath=c:\abc
mybatch=c:\batch\runme.bat

1. How do i use readline method to ignore anything that has 'comments ?

2. What is the best way to read those those variables from mypath and
mybatch ? I can use a do loop, how do i pass c:\abc and c:\batch\runme.bat
into different variables as i execute the programs ?

Nov 21 '05 #2
I assume you have something like this:

Dim line as String

while not line is nothing
line = sr.readline()
if line.StartsWith("'") then
'ignore line
else
'do whatever
end if

end while

Nov 21 '05 #3
"James" <jk****@hotmail.com> schrieb:
i've opened a text file, say config.ini and it contains 3 lines

config.ini
' this is a test file
mypath=c:\abc
mybatch=c:\batch\runme.bat

1. How do i use readline method to ignore anything that has 'comments ?


If you use 'StreamReader' you can read each line of the file and analyze the
text:

Reading a text file line-by-line or blockwise with a progress indicator
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>

For simple string manipulation take a look at the 'String' class' members
and the methods in the 'Strings' module.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

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

Similar topics

6
4888
by: Russell E. Owen | last post by:
At one time, mixing for x in file and readline was dangerous. For example: for line in file: # read some lines from a file, then break nextline = readline() # bad would not do what a naive...
0
4182
by: John C. Worsley | last post by:
I've got an extremely inscrutable problem here using Perl's Term::ReadLine::Gnu module. I'm using Perl 5.8.0, readline 4.3 and Term::ReadLine::Gnu 1.14. The problem is specific to catching INT...
1
4394
by: Jian Qiu | last post by:
Hi, I tried to install python2.4.2. Unfortunately building 'readline' extension failed. Here is what I got: (It is a bit long. If you are impatient, please look at the end where it reports the...
4
6434
by: David Bear | last post by:
I built python 2.4.2 for suse linux 9.3. I configured it to be a separate instance of python from the version packaged with suse. Now when I start it I get an error: python Python 2.4.2 (#4,...
3
1793
by: PointMan | last post by:
what i know is... while ((currentStr = sr.ReadLine()) != null) { in this area, can i get next ReadLine Value of currentStr } best regard,,
0
4705
by: 7stud | last post by:
Hi, 1) Does this make any sense: """ Thus, the loop: for line in f: iterates on each line of the file. Due to buffering issues,
6
3707
by: Sean Davis | last post by:
I have a large file that I would like to transform and then feed to a function (psycopg2 copy_from) that expects a file-like object (needs read and readline methods). I have a class like so: ...
0
2427
by: Akira Kitada | last post by:
Hi list, I was trying to build Python 2.6 on FreeBSD 4.11 and found it failed to build some of the modules. """ Failed to find the necessary bits to build these modules: _bsddb ...
0
1502
by: M.-A. Lemburg | last post by:
On 2008-10-25 08:39, Akira Kitada wrote: Please post a bug report on python.org about these failures. The multiprocessing module is still fairly new and obviously needs more fine tuning for...
0
1919
by: Akira Kitada | last post by:
Hi Marc-Andre, Thanks for the suggestion. I opened a ticket for this issue: http://bugs.python.org/issue4204 Now I understand the state of the multiprocessing module, but it's too bad to see...
0
7041
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
7044
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7084
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...
0
6929
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4779
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
181
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.