readline

  • Thread starter Thread starter James
  • Start date Start date
J

James

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 ?
 
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
 
James said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top