|
-
Nov 13th, 2000, 12:32 PM
#1
Thread Starter
New Member
Hi,
here's my code
Open (txtpath.Text) For Input As #1
Open "a:\temp.txt" For Output As #2
sSearch = txtSstr.Text
isearch = Len(sSearch)
sreplace = txtRstr.Text
ireplace = Len(sreplace)
Line Input #1, sInput
Do
iPos = InStr(1, sInput, sSearch)
If (iPos <> 0) Then
iCount = iCount + 1
sInput = Right(sInput, Len(sInput) - iPos)
Else
Line Input #1, sInput
End If
Loop While (Not EOF(1))
lblIcount.Caption = "The total of strings found and replaced = " & CInt(iCount)
Close #1
Close #2
it seems that the loop exits before reading the last line, I've tried moving the EOF to the do but it does the same thing, and help would be apprecated.
-
Nov 13th, 2000, 12:37 PM
#2
Try
While Not EOF(1)
'yada, yada, yada
Wend
-
Nov 13th, 2000, 12:42 PM
#3
Thread Starter
New Member
EOF
Martin,
tried that but works the same, Thanks Anyway
-
Nov 13th, 2000, 12:43 PM
#4
transcendental analytic
if not eof(1) Line Input #1, sInput
at the first line input statemnt
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 13th, 2000, 02:49 PM
#5
Try this:
Do While Not EOF(1)
'
Loop
-
Nov 13th, 2000, 04:18 PM
#6
That's the same as MartinLiss's except it's a Do Loop.
-
Nov 13th, 2000, 05:13 PM
#7
transcendental analytic
HAha why don't you just suggest Do Until EOF(1) insteaD?
I thought you guys were smarter than that, but actually i think the problem is something else, namely the file isn't in ascii text, but binary data which causes input to read the eof long before the real end of file. 
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 13th, 2000, 05:51 PM
#8
<-was tired when he posted.
Sorry, you know what it's like kedaman, when your tired .
Originally posted by kedaman
HAha why don't you just suggest Do Until EOF(1) insteaD?
I thought you guys were smarter than that, but actually i think the problem is something else, namely the file isn't in ascii text, but binary data which causes input to read the eof long before the real end of file. 
-
Nov 13th, 2000, 05:54 PM
#9
Kedaman-> They both do the same thing.
-
Nov 13th, 2000, 08:54 PM
#10
transcendental analytic
Yeah i know exactly what it's like when i'm tired 
Do while not not not not not not not not not not not not not not not not not not not not not not not not not not not not not not not not not not Eof(1)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|