Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C File permissions in Linux can be set using a 3-digit octal code as you learned before. For example, command chmod 644 file sets

In C

image text in transcribed

File permissions in Linux can be set using a 3-digit octal code as you learned before. For example, command chmod 644 file sets file to be readable by everyone and writable by owner only. If you list the details of the file such a permission is represented by a string of 9 characters " rw-r--r Write a C program rwx2octal that reads from standard input a string of 9 characters (e.g., " rw-r- ") and outputs the octal version of that (e.g., "644"). The program should print out "invalid permission" for any input that is not a valid 9-character string. Note that valid input characters are only 'r', 'w', 'x', and' (we ignore indicators for file-type/setuid/setgid in this exercise.) Also, valid length and order of characters need to be checked. More examples of inputs and expected outputs are as follow. Input Output I r-xr-x--x I 551 I000 I W-r 024 I r-wr-x-x invalid permission | I rwxrwxinvalid permission| I arwxrwxrw | invalid permission

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago

Question

Is there a clear hierarchy of points in my outline?

Answered: 1 week ago