Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 15th, 2006, 4:34 PM   #1
chepfaust
Programmer
 
chepfaust's Avatar
 
Join Date: Feb 2005
Posts: 62
Rep Power: 4 chepfaust is on a distinguished road
[VB6] Resetting "Line Input"

i am parsing a text file using a do loop with a line input statement.

once that loop is done, i need to make another one to parse for something different.

the problem i am having is that when i open up the second loop, line input continues reading from the text file where i left off with the first loop.

pseudocode:
----------------------------------------------
open file for input as #1
-- do until tempstring = "stuff" or EOF(1)
-- -- line input #1, tempstring
-- loop
-- process tempstring a certain way
close #1

open file for input as #2
-- do until tempstring = "something else" or EOF(2)
-- -- line input #2, tempstring
-- loop
-- process tempstring another way
close #2
----------------------------------------------

how do i make line input start from the top of the file? can i manually trick VB into thinking EOF was reached, therefore starting over?
chepfaust is offline   Reply With Quote
Old May 15th, 2006, 5:11 PM   #2
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
why don't you throw a conditional statement in there, instead of looping twice?

Do While Not EOF(1)
line input #1, tempstring
if tempstring == "whatever" then
else
end if
loop
Booooze is offline   Reply With Quote
Old May 15th, 2006, 5:27 PM   #3
chepfaust
Programmer
 
chepfaust's Avatar
 
Join Date: Feb 2005
Posts: 62
Rep Power: 4 chepfaust is on a distinguished road
Quote:
Originally Posted by Booooze
why don't you throw a conditional statement in there, instead of looping twice?
because my code isn't quite as simple as i made it out to be; it's much much longer and has several other nested loops. it's a big mess.
chepfaust is offline   Reply With Quote
Old May 15th, 2006, 7:49 PM   #4
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
That's what I was wondering. Clean up, and then post some of your code. Explain what your trying to do. Perhaps there is a more efficeient way. The other thing I was wondering was where the problem was. It didnt seem as simple as you made it out to be. Perhaps theres another governing factor?
Booooze is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:18 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC