Copying files in Pascal 
Author Message
 Copying files in Pascal

Hi, I'm using TP7 and having a bit of trouble trying to copy 4 files from
my hard disk over to a floppy.

I've been trying to use the exec command (with the xcopy thingy) but it
just doesn't seem to work.

can someone either please send me some code, or at least give me some
command lines to try.

thanks in advance

--

-
it wasn't easy, but nothing never is, no.  -BLUR

Damons rule, Hill and Albarn, Jordan and BLUR



Wed, 18 Jun 1902 08:00:00 GMT  
 Copying files in Pascal


Quote:
>Hi, I'm using TP7 and having a bit of trouble trying to copy 4 files from
>my hard disk over to a floppy.

>I've been trying to use the exec command (with the xcopy thingy) but it
>just doesn't seem to work.

>can someone either please send me some code, or at least give me some
>command lines to try.

Look in the online-help under blockread. There's a program which
copies files

bye,
                 Christoph.



Wed, 18 Jun 1902 08:00:00 GMT  
 Copying files in Pascal

:Hi, I'm using TP7 and having a bit of trouble trying to copy 4 files from
:my hard disk over to a floppy.

 62) How can I copy a file in a Turbo Pascal program?

 161616 Jan 31 1999 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
 tsfaqp.zip Common Turbo Pascal Questions and Timo's answers, linked

   All the best, Timo

....................................................................

Moderating at ftp:// & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa

Spam foiling in effect.  My email filter autoresponder will return a
required email password to users not yet in the privileges database.
Advice on spam foiling at http://www.uwasa.fi/~ts/info/spamfoil.html



Wed, 18 Jun 1902 08:00:00 GMT  
 Copying files in Pascal


Quote:
>Hi, I'm using TP7 and having a bit of trouble trying to copy 4 files from
>my hard disk over to a floppy.

>I've been trying to use the exec command (with the xcopy thingy) but it
>just doesn't seem to work.

>can someone either please send me some code, or at least give me some
>command lines to try.

>thanks in advance

>--

>-
>it wasn't easy, but nothing never is, no.  -BLUR

>Damons rule, Hill and Albarn, Jordan and BLUR

Function CopyFile(n1,n2:string):byte;
var
      FromF, ToF: file;
      NumRead, NumWritten: Word;
      buf: array[1..2048] of Char;
      errore:byte;
begin
      errore:=0;
      {$I-}
      Assign(FromF, n1);
      Reset(FromF, 1);
      if IOResult < > 0 then
         errore:=1              { file not found }
      else begin
         Assign(ToF, n2);
         Rewrite(ToF, 1);
         if IOResult < > 0 then
            errore:=2       { problem destination disk }
         else begin
            repeat
                BlockRead(FromF,buf,SizeOf(buf),NumRead);
                BlockWrite(ToF,buf,NumRead,NumWritten);
            until (NumRead = 0) or (NumWritten  NumRead);
            Close(ToF);
            if (NumWritten < > NumRead) then begin
               errore:=3;             { disk full }
               rewrite(ToF);
               erase(Tof)
            end
         end;
         Close(FromF)
      end;
      {$I+}
      CopyFile:=errore
end;

bye bye  -     fabio
--



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

 Relevant Pages 

1. how to copy files in pascal!!

2. How do you copy files in Pascal?

3. copying files from CD to c:\XX directory in Pascal

4. Copy Files under Borland Pascal for Windows 7.0

5. Copying files - Traping file sharing error

6. Copying files - Traping file sharing error

7. Copy working files to Notebook cpu

8. Problems while copying a file

9. copy file to lpt#?

10. how to copy a file?

11. Copy files from one drive to another

12. copy file

 

 
Powered by phpBB® Forum Software