logo

Crowdly

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

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

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;

}

More questions like this

Want instant access to all verified answers on moodle.coep.org.in?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!