문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top