AA>On Thu, 4 Apr 1996, R. E. Donais wrote:
AA>> we can only guess what it is all about. For example, Reset(DescFile)
AA>> implies that it is a Text file, but is passed as an untyped file. The
AA>> program appears to use a lot of global variables, not of which you
AA>> supplied, etc.
AA>I didn't bother including them no, because i can't see how they would
AA>cause the computer to lock up. All files have been defined as "file",
AA>untyped.
For proper analysis of a problem, it's important to include *all*
information pertaining to the given problem, in order to properly
determine that it isn't part of the problem.
AA>> The first thing that caught my eye is entering into a file read with a
AA>> repeat loop. Wouldn't be too bad, except the test foe an eof condition
AA>> is made at he end of the loop. There is a lot of code that is being
AA>> executed even if you read nothing!
AA>Took out EOF() checks because they were locking up the computer before it
AA>even got to the loop.
A very bad reason. I would imagine that your use (or mis-use) of EOF was
at least part of the problem to begin with.
AA>> I almost {*word*88}d when I saw that you were reading an untyped file one
AA>> character at a time. This really isn't an error and I try not to
AA>> critize the base design but this one took my breath away. If you're
AA>> trying to create a sloooow program, you are on the right track. :)
AA>Only way I can figure out how to read a text file since no one in this
AA>newsgroup helped me with such after posting twice. I'll try to read it in
AA>with larger blocks when/if I ever figure out how, but as far as I can tell
AA>that will take about 1000 lines of code because I guess I would need to
AA>including Seeking over and over, and have to keep track more of where I
AA>am in the file.
Have patience. Not everyone that is capable or willing to take the time
to help can respond immediately. It also helps to present the problem
clearly, showing that you've put some thought into it already (not
saying that you didn't). Have a look at BlockRead/BlockWrite if you
haven't yet.
AA>> You need to re-think what you are doing. A repeat loop executes once,
AA>> so if the file is empty, you're cooked! That's why you see most code
AA>> using a while loop for reading files.
AA>Perhaps if it wouldn't lock up.
If it's locking up then there is something wrong with your code. It's
guaranteed that a REPEAT/UNTIL loop will eventually cause problems down
the road.
-- Kim Forwood --
/-=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=-\
$ Kim Forwood <kim.forw...@access.cn.camriv.bc.ca> %
% For what purpose is life, if one cannot live freely? $
\-=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=-/