Re:Break doesn't work on longer file
In article <VA.00001dd2.0034a...@braser.com>, Brad Blanchard <g...@ctv.es>
writes:
Quote
> What is the fastest way to find the LAST occurence of the word 'Custom' in
>the
>file? Any help will be appreciated.
Are you wanting this to prevent the other errors, or do you just want to find
only the last occurence.
If the former then I would suggest you reconstruct you search algorithm to
provide protection against list index errors at every search node. If the
latter then just start at the end of the file and work back, decrementing the
list index (but checking to protect against < 0 errors).
You might find it easier/better to use a file or memory stream. You'd have to
read it by byte or use a search algorithm (like Boyer-Morse-Horspool).
The first thing to do in any case is to clearly identify your strategy for
doing what you want to achieve.
After that coding becomes easy/easier <g>.
Quote
> You have identified the problem. I feel silly now for not having seen it
>before. Once again, thanks Alan.
Don't feel too bad about it - I've just spent some frustrating time bug-hunting
because I had not immediately realised that ...
(A div 1000) * B * C
... was not the same as ...
(A * B * C) div 1000
.. which latter had suffered from overflow errors and needed changing.
<g>.
Alan Lloyd
alangll...@aol.com