|
-
Nov 16th, 2000, 05:38 AM
#1
Thread Starter
Addicted Member
I'm trying to edit a file in VB. I'm retreiving a text file using the INET control from the internet, getting text from the screen and saving as a *.txt file. I then need to get rid if the first 500 lines which have a # at the begining, convert the file to a *.dat file to use in SQL*loader to populate a database table. The problem I'm having is that when I open up the text file it all goes onto 1 line (with carriage return blocks). I need to be able to read individual lines so that I can discriminate as to which lines I want to place into my new file. I tried to combat this by saving the file as a Word document instead, but the same happens. I'm trying to read a line like this:
FileName = Command() + "nng_list.DOC"
FileNumber = FreeFile
Open FileName For Input Access Read As #FileNumber
Do Until EOF(FileNumber)
Line Input #FileNumber, Data
But instead of the first line being read, all lines append to make one big line. Can anyone suggest a reason why its doing this and how I can combat it!
Code below:
IntFileNum = FreeFile()
strURL= "http://www.warwick.ac.uk/list.txt"
Open Command() + "list.DOC" For Output As IntFileNum
Write #IntFileNum, Inet1.OpenURL(strURL)
Close IntFileNum
' Download File
FileName = Command() + "list.DOC"
FileNumber = FreeFile
Open FileName For Input Access Read As #FileNumber
Do Until EOF(FileNumber)
Line Input #FileNumber, Data
' New File
WriteFile = Command() + "list.DAT"
WriteFileNumber = FreeFile
Open WriteFile For Append Access Write As #WriteFileNumber
If Data <> "#" Then Print #WriteFileNumber, Data
Loop
Close #FileNumber
Close #WriteFileNumber
RetVal = Shell(Command() + "control.bat", 1)
End
End Sub
Any help would be really appreciated,
Cheers 'n' beers
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
|