Urgent help needed with GFx mode and BlockRead/BlockWrite 
Author Message
 Urgent help needed with GFx mode and BlockRead/BlockWrite

Hello Everyone,

I have a major computing project to hand in tomorrow, so far
i've written bout 4500 lines, gone the whole hog, GUi, multiple
indexes, printing, multiuser access etc. BUT (notice the
capitals?) When I run my backup and recovery procedures, they
draw over my lovely desktop, with large grey blocks. I find that
this only happens with my backup and recovery procedures.

Here is the code (sorry about the state of it, I haven't
optimised it yet). Know that it does work in normal textmode
without a problem, but in graphics it's a swine.

Thanks in advance for any help you can give

James

Procedure Backup(Q:FileArray; FileCount:Integer);
Var i, ChunkNumber:Integer;
    Source, Target:File;
    Chunk, FIleNumber:String;
    ChunkSize:Longint;
    FileBuffer:Array [1..1024] of byte;
    BytesRead, Problem:Word;
Begin
     Repeat
     If Not DiskError('A') then
     Begin
          If DiskFree(1)<SizeOf(Q) then
             Repeat
                   OpenWindow('DISKSPC.WIN', TRUE);
                   MonitorInput;
                   CloseWindow;
             Until (Not DiskError('A')) and (DiskFree(1)>SizeOf
(Q));

          Assign(Target, 'A:\CATALOG.DAT'); <=No problem writing
this file
          Rewrite(Target, SizeOf(Q));
          BlockWrite(Target, Q, 1);
          Close(Target);

          For i:=1 to FileCount do
          Begin
               CheckCreateDir(ERFPath+'\'+Q[i].Filename);
               CheckCreateFile(ERFPath+'\'+Q[i].Filename);
               Assign(Source, ERFPath+'\'+Q[i].FileName);
               Reset(Source, 1);
               ChunkNumber:=1;
               Repeat
                     Str(ChunkNumber, Chunk);
                     Str(i, FileNumber);
                     If FilePresent('A:\'+FileNumber+'.'+Chunk)
then
                        EraseFile('A:\'+FileNumber+'.'+Chunk);

                     Repeat
                           ChunkSize:=DiskFree(1);
                           If ChunkSize=0 then
                           Begin
                                OpenWindow('DISKNXT.WIN', TRUE);
                                MonitorInput;
                                CloseWindow;
                           End;
                     Until ChunkSize<>0;

                     CheckCreateFile('A:\'+FileNumber+'.'+Chunk);
                     Assign(Target, 'A:\'+FileNumber+'.'+Chunk);
                     Rewrite(Target, 1);
                     Repeat
                           ChunkSize:=DiskFree(1);
                           If ChunkSize>SizeOf(FileBuffer) then
ChunkSize:=SizeOf(FileBuffer);
                           BlockRead(Source, FileBuffer,
ChunkSize, BytesRead);
                           BlockWrite(Target, FileBuffer,
BytesRead); <= I think it screws up here!
                     Until (ChunkSize=0) or Eof(Source);

                     If (ChunkSize=0) and Not Eof(Source) then
Inc(ChunkNumber);
                     Close(Target);

               Until Eof(Source);
               Q[i].Chunks:=ChunkNumber;
               Close(Source);
          End;
          Q[100].Chunks:=FileCount;

          Repeat
                If Not DiskError('A') then
                Repeat
                      If Not FilePresent('A:\CATALOG.DAT') then
                      Begin
                           OpenWindow('DISK1.WIN', TRUE);
                           MonitorInput;
                           CloseWindow;
                      End;
                Until FilePresent('A:\CATALOG.DAT')
                else
                Begin
                     OpenWindow('DISK.WIN', TRUE);
                     MonitorInput;
                     CloseWindow;
                End;
          Until (Not DiskError('A'));

          Assign(Target, 'A:\CATALOG.DAT');
          Rewrite(Target, SizeOf(Q));
          BlockWrite(Target, Q, 1);
          Close(Target);
     End
     else
     Begin
          OpenWindow('DISK.WIN', TRUE);
          MonitorInput;
          CloseWindow;
     End;
     Until not DiskError('A');
End;

* Sent from RemarQ http://www.*-*-*.com/ The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Wed, 18 Jun 1902 08:00:00 GMT  
 Urgent help needed with GFx mode and BlockRead/BlockWrite
PLEASE HELP ME, I'M DOOMED

and please don't quote "homework question" at me

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Wed, 18 Jun 1902 08:00:00 GMT  
 Urgent help needed with GFx mode and BlockRead/BlockWrite
Fixed it, sorry, there was a rogue clrscr in one of my procedures

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Blockread/Blockwrite question.

2. Blockread/Blockwrite question

3. BLOCKREAD&BLOCKWRITE?

4. blockread/blockwrite

5. Blockread / Blockwrite

6. How do I use BLOCKREAD/BLOCKWRITE

7. Mode 13h Gfx unit, help please.

8. help need with BlockRead

9. Problems Accessing GFX Mode Second Time Round!

10. Need GFX-Lib!

11. Urgent Help Needed on Reporting

12. BDE: Urgent help needed

 

 
Powered by phpBB® Forum Software