|
-
Nov 22nd, 2000, 07:11 AM
#1
Thread Starter
Addicted Member
I'm trying to read each line of a text file into an array, I'm using vbCrLf as the delimiter but the whole file is being read into the first elemnt. I'm using the split function but it doesn't seem to like it. Can anyone see where I'm going wrong?
FileName = Command() + "nng_list.TXT"
FileNumber = FreeFile
'Open file and read lines
Open FileName For Input Access Read As #FileNumber
Do Until EOF(FileNumber)
'Assign content to variable
Line Input #FileNumber, Data
'Create New File of type *.DAT for use in SQL*Loader.exe
WriteFile = Command() + "nng_list.DAT"
WriteFileNumber = FreeFile
'Open New File for writing to
Open WriteFile For Append Access Write As #WriteFileNumber
'Split function to disect data
Datak = Split(Data, vbCrLf)
'Datak = Split(Data, "#", -1)
'Discard unwanted data
Print #WriteFileNumber, Datak()
Loop
Cheers all
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
-
Nov 22nd, 2000, 07:21 AM
#2
_______
<?>
there is an an example of split and reading a split found Here . Perhaps it will help.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 22nd, 2000, 07:22 AM
#3
Addicted Member
Hi Skeen !!!
Your problem is in the split command !!!
if you use input to open a file the line delimiter is vbcrlf
in your case u have maybe a file from a unix system.
Unix systems use as default vbcr or vblf as line delimiter.
so change the line
Code:
Datak = Split(Data, vbCrLf)
'to
Datak = Split(Data, vbCr)
'or
Datak = Split(Data, vbLf)
hope this helps
-cu TheOnly
-
Nov 22nd, 2000, 07:41 AM
#4
Thread Starter
Addicted Member
Nice 1 Brother
Cheers man
I'm a bit of a unix virgin and integrating NT and Unix is a bit confusing to me at the moment.
Thanx again
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
-
Nov 22nd, 2000, 07:51 AM
#5
Thread Starter
Addicted Member
You Da Man!
Yeah TheOnly
You da man - I've been at that for 2 dayz, worked a fookeen charm.
Cheers m8
skeen
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
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
|