Bill Jonas on Tue, 27 Nov 2001 22:30:17 +0100 |
On Tue, Nov 27, 2001 at 12:49:28PM -0500, Kyle R . Burton wrote: > I'm not sure about explicitly copying a file without writing a function > of your own...though that should be fairly easy, it's inconvienient and > won't take advantage of kernel side speed. K&R 2nd Ed. has a simplistic cp program. It's basically just a while loop using getchar and putchar. ("while ((c = getchar()) != EOF)"...) Of course, it would be much more efficient to use read(2)/write(2) or fread(3)/fwrite(3); the latter are in stdio.h and the former are in unistd.h. The major difference that I can see is that the former uses file descriptors while the latter uses (FILE *) structures. BTW, is that the only real difference between them, or is there an advantage to one set over the other? -- Bill Jonas * bill@billjonas.com * http://www.billjonas.com/ Developer/SysAdmin for hire! See http://www.billjonas.com/resume.html Attachment:
pgps4DyWywdMH.pgp
|
|