473,574 Members | 18,329 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trying to read a line from a file

Hi again. <g> This time, I'm having trouble reading a single line from a
file. The line reads, "DBPATH=[full path of database file goes here]." But
when I use the Input function, it only writes to the variable up to the
first space in the path. In other words, if the path was
"C:\Software\Ut ilities and Applications," the variable would read,
"DBPATH=C:\Soft ware\Utilities. " It basically determines a space to be the
beginning of a new section of the file or something. How can I get it to
read an entire line?? Thanks...

Jay
Nov 20 '05 #1
3 1083
"jy836" <mo***@nospam.c om> schrieb
Hi again. <g> This time, I'm having trouble reading a single line
from a file. The line reads, "DBPATH=[full path of database file goes
here]." But when I use the Input function, it only writes to the
variable up to the first space in the path. In other words, if the
path was "C:\Software\Ut ilities and Applications," the variable would
read, "DBPATH=C:\Soft ware\Utilities. " It basically determines a space
to be the beginning of a new section of the file or something. How
can I get it to read an entire line?? Thanks...

Hmmm.... Use LineInput instead?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Cor
Hi Jy836 are you sure it is a common. txt file?

And otherwise use the streamreader as sample written here watch typos.
\\\
Try
Dim sr As StreamReader = New StreamReader("M yFile.txt")
Dim line As String
line = sr.ReadLine
Do until line Is Nothing
messagebox.show (line)
line = sr.ReadLine
Loop
sr.Close
Catch Ex As Exception
messagebox.show (Ex.Message)
End Try
///
I hope this helps

Cor
Nov 20 '05 #3
* "jy836" <mo***@nospam.c om> scripsit:
Hi again. <g> This time, I'm having trouble reading a single line from a
file. The line reads, "DBPATH=[full path of database file goes here]." But
when I use the Input function, it only writes to the variable up to the
first space in the path. In other words, if the path was
"C:\Software\Ut ilities and Applications," the variable would read,
"DBPATH=C:\Soft ware\Utilities. " It basically determines a space to be the
beginning of a new section of the file or something. How can I get it to
read an entire line?? Thanks...


Use 'PrintLine' for writing the line and 'LineInput' to read the line.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

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

Similar topics

0
4957
by: Matt | last post by:
I'm trying to get the HTML data off of a webpage. Let's say for the sake of argument it's the python homepage. I've googled around and found some examples that people said worked. Here's what I've cobbled together: #getHTML.py ############################################ import urllib import urllib2 proxy_info = {'user':'us3r',
8
2065
by: Rich Grise | last post by:
I think I've finally found a tutorial that can get me started: http://www.zib.de/Visual/people/mueller/Course/Tutorial/tutorial.html and I've been lurking for awhile as well. What happened is, I've been playing with Qt in KDE on a Slackware 10.0 system, and following their cookbook exercises, and everything's working, and I have no clue...
4
2658
by: Jeff Rodriguez | last post by:
Main just loops over this while it's not null. The segfault occurs at this line: *line = (char)ch; Also, please don't just fix the code. I would like to know why exactly this isn't working so I can avoid problems with it in the future. If there are any references I should check out let me know. Full highlighted code at:
4
2475
by: yo_mismo | last post by:
Hi everyone, I'm trying to read the first line of a file this way: .... .... .... .... new_line=0; while((read=read(fd, &info, sizeof(info))) > 0 && !new_line){ if (strcmp(&info, "\n") != 0){
1
1542
by: Ty Moffett | last post by:
I am trying to write a little app that will perform unattended installations of various software packages. I have a text file, each line is a string containing the complete command to start a silent/unattended install. I have successfully read the entire file and each line gets added to the queue. On this line...
3
2735
by: jdjohns74 | last post by:
I've never written a Python program before and I'm trying to read a config file with file path/names (eg. c:\\python24\\*.dll, ... *.exe) to create an ouput file of filename + md5 values. I'm confused. I'm trying to lern how to use Wing IDE and step through the Stack Data. It seems to be working but on the for fn in filelist: data =...
1
1489
by: James Johnston | last post by:
I've never written a Python program before and I'm trying to read a config file with file path/names (eg. c:\\python24\\*.dll, ... *.exe) to create an output file of filename + md5 values. I'm confused. I'm trying to learn how to use Wing IDE and step through the Stack Data. It seems to be working but on the for fn in filelist: data =...
16
3233
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will not print in the username or email amddress of the person doing the download - which I am collecting from a form on the previous page. I can get...
1
1971
by: jonathan184 | last post by:
trying to rename filenames and extensions then add a header in line1 of each file if the header existed in line 1 to go to the next file. but i am getting error explciti errors Here is my code I am using #!/usr/bin/perl user warnings;
0
7817
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7833
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8119
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5635
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5322
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3759
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3771
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1082
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.