Quote:
Originally posted by mike_cana
Code:
if (*acctFd = (fd = open(path, "O_CREAT", "r+")) < 0)
|
your second and third arguments to open(2) are garbage. O_CREAT is a defined value, not a string literal. include the following headers if you haven't done so already, and it will be defined for you.
Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
the 3 argument version of open takes a numerical value which defines the mode bits of the file you want created. there are convenient defines for this one as well.
Code:
open(path, O_CREAT, S_IRUSR | S_IWUSR);
try "man 2 open" for more details.