error 200 on blockread (w/ patched tpl files)
Author |
Message |
Carol #1 / 5
|
 error 200 on blockread (w/ patched tpl files)
Please forgive if this is dumb, but I don't do Pascal, so I am a fish out of water. I am tweaking an old program (Turbo Pascal 7.0) to read data in from binary files instead of from an instrument so I can compare the results with the new c++ version I'm working on, and I am getting error 200 on the blockread. This _shouldn't_ be from the crt/200 problem as we are using a fix, and the original program runs fine. Any ideas? I hope I am just doing something wrong. {initialize filecount to name files to read into test} fcount := 1500; {$I-} assign(dFile,DataDirectory + 'filename.bi'); reset(dFile,0); {$I+} If IOResult <> 0 then begin MessageBox('Error: File does not exist.', nil, mfError+mfOKButton); end; {stops with error here ->} BlockRead(dFile,BCODE,fcount,len); close(dFile); The keyboard is imprinted on my face at this point, hair torn out, white coats at the ready. Thanks, Carol G
|
Wed, 27 Apr 2005 05:13:24 GMT |
|
 |
Marco van de Voor #2 / 5
|
 error 200 on blockread (w/ patched tpl files)
Quote:
> Please forgive if this is dumb, but I don't do Pascal, so I am a fish > out of water. > results with the new c++ version I'm working on, and I am getting > error 200 on the blockread. This _shouldn't_ be from the crt/200 > problem as we are using a fix, and the original program runs fine. > Any ideas? I hope I am just doing something wrong. > {initialize filecount to name files to read into test} > fcount := 1500; > {$I-} > assign(dFile,DataDirectory + 'filename.bi'); > reset(dFile,0);
What does the above line mean? Quote: > {$I+} > If IOResult <> 0 then > begin > MessageBox('Error: File does not exist.', nil, > mfError+mfOKButton); > end; > {stops with error here ->} BlockRead(dFile,BCODE,fcount,len); > close(dFile); > The keyboard is imprinted on my face at this point, hair torn out, > white coats at the ready.
The second parameter of the reset line is the record size. Blockread calculates the number of bytes to read by multiplying with that number (and possibly divides somewhere or calcs a modulo). It probably should be reset(dfile,1);
|
Wed, 27 Apr 2005 05:27:54 GMT |
|
 |
Ralf A. Quin #3 / 5
|
 error 200 on blockread (w/ patched tpl files)
Quote: >Please forgive if this is dumb, but I don't do Pascal, so I am a fish >out of water. >I am tweaking an old program (Turbo Pascal 7.0) to read data in from >binary files instead of from an instrument so I can compare the >results with the new c++ version I'm working on, and I am getting >error 200 on the blockread. This _shouldn't_ be from the crt/200 >problem as we are using a fix, and the original program runs fine. >Any ideas? I hope I am just doing something wrong. > {initialize filecount to name files to read into test} > fcount := 1500; > {$I-} > assign(dFile,DataDirectory + 'filename.bi'); > reset(dFile,0);
Reset (..,0)??? 0 byte length records? Well that has to give a "division by zero error"!!! Ok, there is probably no real division, but it could be possible that the blockread code uses the same error message number to show such an error... Ralf
|
Thu, 28 Apr 2005 04:21:58 GMT |
|
 |
Carol #4 / 5
|
 error 200 on blockread (w/ patched tpl files)
Quote: > Reset (..,0)??? 0 byte length records? Well that has to give a > "division by zero error"!!! > Ok, there is probably no real division, but it could be possible that > the blockread code uses the same error message number to show such an > error... > Ralf
Ralf and Marco, Aha, I was doing something dumb! Thanks much! Carol G.
|
Fri, 29 Apr 2005 22:45:23 GMT |
|
 |
Ralf A. Quin #5 / 5
|
 error 200 on blockread (w/ patched tpl files)
Quote: >> Reset (..,0)??? 0 byte length records? Well that has to give a >> "division by zero error"!!! >> Ok, there is probably no real division, but it could be possible that >> the blockread code uses the same error message number to show such an >> error... >> Ralf >Ralf and Marco, >Aha, I was doing something dumb! Thanks much! >Carol G.
No problem..;-))) I know that this is the kind of bug you keep looking yourself at over and over again and won't see it until someone tells you.... Welcome to the wonderful world of programming.... ;-))) take care, Ralf
|
Sat, 30 Apr 2005 01:45:45 GMT |
|
|
|