home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-23 | 3.1 KB | 101 lines | [TEXT/ttxt] |
- CopyFile
- ========
-
- written on Saturday, 23th of April 1994
- (a sunny day, its a pitty I have to work)
-
- A sample application illustrating how to copy a file on Macintosh
- ----------------------------------------------------------
-
- Credits: This application is based on gencopy, originaly
- written in 1987 by Jerry LeVan, Richmond
- for MPW C v1.0 on MacPlus with Finder 5.3 and System v3.2
-
- The introduction found in CopyFile.c was left unchanged.
-
- What is it?
- ----------
-
- I changed the original application to be compiled with Symantec C++ 6.0 for System 7.x.
- Therefore I did the following:
-
- - Changed the file name to CopyFile.c (fount it more illustrative)
-
- - Built a Project File for Think Project Manager
-
- - Separated the Rez-Source-Code from the C-Source-Code
- into the File CopyFile.r
-
- - Added the necessary #include "Types.r" for Think Rez.
-
- - Beautified the source code to understand its structure !-)
-
- - Killed the includes, because Symantec C++ automaticaly
- includes all necessary header files by default
-
- - Replaced all assignment-comparisons
- if ( (a = b) == c); becomes a = b; if (a == c);
- to avoid the warning about a maybe "uninteded assignment"
-
- - Changed all function declarations to ANSI-Standard
-
- funcname(a)
- int a;
-
- becomes
-
- funcname(int a)
-
- - Fixed a bug found this way in the call to the function CopyDataFork.
- The parameter called creator was missing. :-(
-
- - Compiled and tested it on a Quadra 950 (the appropriate machine for
- this application) and found it worked.
-
- - Changed the buffer size from 1024 to 8192. If You use a machine with
- 64 MB RAM, it does not matter, but it is much faster.
-
- Who is it?
- ---------
-
- My name and adress is:
-
- Torsten Schlabach
- Harzburgerstr. 16
- D-47259 Duisburg
- Germany
-
- Phone: +49 - 203 - 784 292
- E-mail: CompuServe: 100335,243
- Internet: 100335,243@Compuserve.com
-
- Problems and possible improvements
- ---------------------------------
-
- If the file You try to copy is open, everything seems to work correctly,
- but the destination file is empty. Feel free the fix it. I could not do so,
- because my mam wanted me to have dinner now.
-
- In System 7.x there is a function called PBHCopyFile, wich allows copying
- a file on the same volume or between different volumes on the same
- AppleTalk-Fileserver. This avoids transferring the file twice trough
- the network. Feel free to let the application recognize, if the
- circumstances allow the use of this function and then call it.
-
- For gaining higher speed, why not find out the total file size and
- try to allocate a buffer that is big enogh to allow copying the file with
- one read and one write operation per fork.
-
- Copyright
- ---------
-
- This application is provided as is without any warranties. It is as
- free as the underlying gencopy.c by Jerry LeVan.
-
- Interested in a C++-Class for Copying files? Or in other C++-Classes?
- -----------------------------------------------------------------
-
- I developed some C++-classes for use with Think C/Symantec C++, which I sell
- for a symbolic price of $5 each. Please contact me through Compuserve for a
- complete list or ask me for a specific class.
-