9main (
int argc,
char *argv[])
15 printf (
"usage: cp OLD NEW\n");
20 in_fd =
open (argv[1]);
23 printf (
"%s: open failed\n", argv[1]);
30 printf (
"%s: create failed\n", argv[2]);
33 out_fd =
open (argv[2]);
36 printf (
"%s: open failed\n", argv[2]);
47 if (
write (out_fd,
buffer, bytes_read) != bytes_read)
49 printf (
"%s: write failed\n", argv[2]);
int main(int argc, char *argv[])
cat.c
int printf(const char *format,...)
Writes formatted output to the console.
bool create(const char *file, unsigned initial_size)
int open(const char *file)
int write(int fd, const void *buffer, unsigned size)
int read(int fd, void *buffer, unsigned size)
#define EXIT_SUCCESS
Typical return values from main() and arguments to exit().
#define EXIT_FAILURE
Unsuccessful execution.