Chris, One "problem" is that the cp command is actually implemented the same as the CI :COPY command. This implementation is performance tuned to take advantage of proprietary information - you'll not likely do as well in your own programs. Another possible source of delay is the use of the C routines to open and read the file. Since the C language does buffering for you, there are extra copies being done for each read. Finally, it's possible that your buffer size can be tuned either up or down. The C read() routine breaks up large requests into multiple FREAD requests due to the limits of the bufsize parameter to FREAD. You might get better performance doing this on your own. Try using a 65536 byte buffer and the FREAD intrinsic... Steve Christian Zahl ([log in to unmask]) wrote: : Hi, : a friend of mine has a stupid problem: I wrote an application which : has to read several files of 1.4MB (floppy files) in a C program. : The problem is that it takes about 15 seconds (!) to read in one : of these files. The same is true while writing the files. So the : same program runs about 20 seconds on my UNIX devellopement system : and more than 200 seconds on the HP system. We tracked down that : the section where only the CPU is needed takes the same time on both : systems. Here is a small test program for tracking down the problem: : #include <stdio.h> : #include <fcntl.h> : char buf [100*1024]; : int f; : main () : { : f = open ("foo", =_RDONLY, 0); : while (1) { : if (read (f, buf, sizeof (buf)) <= 0) : break; : fprintf (stderr, ".\n"); : } : close (f); : } : Assuming that the file foo is 1.4MB big, it takes about 15 seconds : to read it. Aproximately every second you see the "." on the screen. : But a "cp foo bar" in the POSIX environment just takes 2 seconds for : copying a 1.4MB file?! : So the hot question is, how to tune up the program, so that the 1.4MB : can be read in much faster? : Many thanks in advance, : Chris