DEV Community

Michael Otieno Olang
Michael Otieno Olang

Posted on

Shell Programming Using C Programming Language

The following C_Program is used to append text from one file to the end of another file. Does any one have an Idea on how I can implement the code using the COMMANDLINE ARGUMENTS and the various FLAGS
Image description

Top comments (3)

Collapse
 
mikeyolang profile image
Michael Otieno Olang • Edited

I think its correct that way since we need the cotent of source file to be copied to destination file, so if both files does not exist we throw an error.
However if we must use "OR" then we need to add a code that can create the destination file then append.

Collapse
 
tonnerkiller profile image
tonnerkiller

I don‘t really understand the question, but you can use stuff from the command line through the argc and argv variables of the main function.
You might wanna research that.

Collapse
 
mikeyolang profile image
Michael Otieno Olang

Now thats exactly what I need to know , how to implement the argc and the argv and also the various flags such as O_RDONLY E.t.c