Question

In C:

if( (opfd= open(fpath, O_CREAT | O_RDWR, 777))<0) 
    {perror("open sys call");
    exit(1);}

then i write an array to this file (works fine) then close(opfd); when i iterate again and try to enter the same file name, it gives me this error "Permission denied" while i set the permissions to 777

Was it helpful?

Solution

Maybe you should try 0777 (which is octal -- and not the same as 777). A leading 0 in C denotes an octal value.

BTW, 777 (decimal) is 1411 (octal), which would seem to explain why you're having trouble overwriting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top