|
-
May 26th, 2005, 06:31 PM
#1
Thread Starter
Lively Member
using the input command, but ignoring commas
i have a cfg file that i need to read, but ive come across a problem. i need to read it a line at a time, but the lines may have commas in them. i tryed to just use the input command, but it seperated what it was reading in by the commas.
for example, this might be the first line of the text file
i want to input that into a variable, but right now i can only figure out how to read the "for example" and " this might be the first line of the text file" seperatly, since they are seperated by a comma.
i didnt make the cfg file, so i have to read it as is. any help is appreciated
-
May 26th, 2005, 06:40 PM
#2
Re: using the input command, but ignoring commas
Well, I'm not shur about how to read a single line at a time but, you could use an alternative; read the whole fine inot an array and then opperate functions using the array 
VB Code:
Dim intFree As Integer
Dim strReadText As String
Dim strTextLines() As String
intFree = FreeFile
Open "C:\SomeFile.cfg" For Binary Access Read As #intFree
strReadText = Space$(LOF(intFree))
Get #intFree, , strReadText
Close #intFree
' Create array of text lines from the file...
strTextLines = Split(strReadText, vbNewLine)
MsgBox strTextLines(0) ' First line...
MsgBox strTextLines(1) ' Second line...
Is an example I posted earlier today 
Cheers,
RyanJ
-
May 26th, 2005, 07:01 PM
#3
Re: using the input command, but ignoring commas
instead of using Input, use Line Input.
casey.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|