That seems to open a man for other things.
Open gives man page for openvt, write for messages to users etc...
As regards the program above,
It seems to be compiling fine and running fine.
It creates the output file fine, but the permissions on the file seem to be random.
EDIT: Didn't set permissions after O_CREAT. So program was using random stack values to set permission.
It's not actually reading the input file right I don't think...
#define STR(arg) #arg
#define BUF_SIZE 160
#define BUF_FORMAT "%160[^\n]s"
FILE *output, *input, *buffer; /* declarations*/
int main (int argc, char *argv)
if ( argc < 2 ) /* Error message if no Args entered */
write(1, "\n **************** \n Not enough Arguments Supplied\n ****************\nPlease enter an Output file to append to, followed by any input files\n \n", 142);
else /*Output file opened or created */
openstatone = open(argv, O_CREAT, 0777);
if (openstatone > 0)
if (argc == 2) /*If only one Arg entered*/
write (1, "No input files appended to Output File.\n", 40);
else /* start append section */
i = argc -2;
j = 2;
printf ("i = %d\n", i);
printf ("j = %d\n", j);
while (i > 0) /*Loop through all input files*/
/*printf ("%s\n", argv[j]);*/ /* Used for Error Checking*/
openstattwo = open(argv[j], O_RDONLY);
if (openstattwo > 0) /*Check fopen worked */
read (argv[j], buf, 160);
printf("%s\n", buf); /* Used for Error Checking */
write (argv, "%s\n", buf);
write (1,"SUCCESS! Input File: %s was Successfully appended\n", argv[j], 80);
write (1, "FAILURE! Input File: %s Failed to Open or does not exist\n", argv[j], 80);
write (1, "\nFiles Appended Successfully\n\n", 80); /*Files Appended Successfully*/
/*write (1, "Output file failed to Open", 80);*/