>After RT error 150 (Disk is write protected) during Erase non-empty file,
>BlockWrite or Close after write, the program gets the same error (RT150)
once
>more (either for next I/O operation, or later). Can you tell me if it is my
>error, BP error or operating system error?
>Similar problem in both real and protected mode, and in TurboVision
programs too
>(but the error number may be 19 instead of 150).
>This problem occured on every hardware I have tried (486, P133, P200MMX,
Celeron
>266, P II 350).
>Problem occured under MSDOS 6.20, 6.22, PCDOS 6.3 and Windows 95/98 when
booted
>in dos-only mode; did not occur under Windows NT 4.0 nor on Windows 95/98
when
>booted GUI.
>There may be a problem in the standard Pascal's INT24 handler (maybe the
DOS 54H
>function call isn't enough to "get DOS into a stable state"?) or in other
part
>of the RTL. There may be a correction in BP 7.01 but I only have BP 7.0 -
could
>you try it?
>Source enclosed. Steps to demonstrate the problem:
> 1. Assure that the program will be able to create, write and delete
> a temporary file c:\$$$.$$$ (or change the TempFName constant).
> 2. Compile the program (for real mode).
> 3. Prepare a diskette with a non-empty file 'TRY.TRY' in root directory.
> Notice that the file MUST not be empty - otherwise the problem does
> not occur, at least at me.
> 4. Boot clean DOS (press F5 to bypass CONFIG.SYS and AUTOEXEC.BAT).
> (You can experiment with different configurations too;
> if you run Windows 95/98, try when restarted in DOS-only mode.)
> 5. Write-protect the diskette and insert it into drive a:
> 6. Run the program.
> You get this output:
> erase a:\... error 150;
> if you get some additional error 150 message (I get it regularly),
> the problem occured.
>I would appreciate any message (tell me your compiler version, OS, and if
the
>problem occured).
>{ **************************************************************** }
>program Try;
>{ Program to demonstrate Borland Pascal 7.00/MSDOS error (?):
> after error 150 (disk is write protected), some next operation fails
> with error 150 again. }
>{$i-}
>const
> TryFName = 'a:\TRY.TRY'; { name of existing non-empty file on
write-protected
>disk }
> TempFName = 'c:\$$$.$$$'; { name for temporary file that program can
create }
>var
> f: file;
> er: Integer;
> i: Integer;
>begin
> { try to write to write-protected disk }
> assign (f, TryFName);
> erase (f); er := IOResult;
> writeln ('Erase ',TryFName,': error ',er);
> { perform some operations on TempFName and report errors if any }
> assign (f, TempFName);
> for i := 1 to 100 do begin
> rewrite (f,1); er := IOResult;
> if (er <> 0) then writeln ('Run ',i,': Rewrite error ',er);
> BlockWrite (f, i,sizeof(i)); er := IOResult;
> if (er <> 0) then writeln ('Run ',i,': BlockWrite error ',er);
> close (f); er := IOResult;
> if (er <> 0) then writeln ('Run ',i,': Close error ',er);
> erase (f); er := IOResult;
> if (er <> 0) then writeln ('Run ',i,': Erase error ',er);
> end;
>end.