logo

Crowdly

Write the possible contents of the file /tmp/xyz after this program. In the an...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Write the possible contents of the file /tmp/xyz after this program.

In the answer if you want to mention any non-text character, then write \0  For example abc\0\0 means abc followed by any two non-text characters

int main(int argc, char *argv[]) {

    int fd1, fd2, n, i;

    char buf[128];

    fd1 = open("/tmp/xyz", O_WRONLY | O_CREAT, S_IRUSR|S_IWUSR);

    write(fd1, "hello", 5);

    fd2 = open("/tmp/xyz", O_WRONLY, S_IRUSR|S_IWUSR);

    write(fd2, "bye", 3);

    close(fd1);

    close(fd2);

    return 0;

}

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.coep.org.in?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!