1) Yes. There is a diference: Buffered or non-buffered I/O.
open()
gives to you a RAW file handle (there isn´t a buffer between your program and the file in the file system).
fopen()
gives to you the permission to work with files in stream buffer mode. For example, you can read/write data line-by-line (\0).
You can see the big diference when work with functions like: fprintf()
, fscanf()
, fgets()
, fflush()
.
ps: fopen()
isn´t better than open()
. They are different things. Some times you need stream buffer (fopen), some times you need work byte-by-byte (open).
Here is a good reference about stream: http://www.cs.cf.ac.uk/Dave/C/node18.html#SECTION001820000000000000000
2) To open in append mode, add O_APPEND
flag:
open(argv[j+1],O_CREAT|O_APPEND|O_WRONLY,0600);