In order to add files (or even one file) to an archive file, you first need to know the format of the archive. If you've studied the documentation for the file format as provided by your OS, (as was advised in this answer to your previous question,) then you should already know enough about the file format that you shouldn't need to ask us how to do it.
C does not have functions named OPEN
or WRITE
. there are open()
and write()
, however, be advised that O_RDONLY|O_WRONLY
is not equivalent to O_RDWR
. You could use write()
to write the content of the file to the end of the archive, yes, but (a) don't forget to write the file header first, and (b) are you sure you don't need to update the archive's symbol table? (If you do, you may need to rewrite the entire file.)
Why aren't you just using the ar
command-line utility, again?