So, I am creating a new file:
fd = open("tester.txt", O_CREAT | O_RDWR);
then using the write system call, I add some information to it. But when I try to read information from a file, it is impossible to do. Using the terminal , I found that the only way to open the file is to use sudo and the content is successfully written . However, my program cannot be root. So, how can I open a file, write some content to it and not close the C program, output the file.
; :
fd = open("tester.txt", O_CREAT | O_RDWR, 0644);
-rw-r--r--, . , .. ---------, root ( chmodding , ).
-rw-r--r--
---------
, O_CREAT open(), . man- open()
int open(const char *pathname, int flags, mode_t mode);
. , O_CREAT ; O_CREAT , .
fd = open("tester.txt", O_CREAT | O_RDWR, 0664 );
, .
Source: https://habr.com/ru/post/1689384/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1689379/pandas-are-there-any-faster-ways-to-update-values&usg=ALkJrhjuhDs5TsSb2_vvPjb5LF8BJQf1AAКакие общие операции можно сделать более эффективными с помощью Span? - c#The procedure for calculating bitwise operators in Kotlin - kotlinPower limitations in MiniZinc - constraint-programmingUniqueBody is empty when Body is not - exchange-serveraurelia: variable is not printed in user component - javascriptEWS Digital body emails with an empty body after upgrading from Exchange 2007 SP1 to Exchange 2013 - c #AudioKit AKSampler makes weird feedback noise - iosПодавлять предупреждения из зависимостей с помощью диспетчера пакетов Swift - swiftNashorn compiled output as Java class - javaAll Articles