Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C If I want to open any file that ends in .java, I want to report that it doesn't exist. And if I want to

C

If I want to open any file that ends in .java, I want to report that it doesn't exist. And if I want to open a .txt file, any .txt file, I want to redirect to a file called "hello.txt". I know I should use errno but I'm not sure how to use it.

This is what I have so far:

int open(const char *filename, int flag)

{

size_t len = strlen(filename);

return (*origin_opening)(filename,flags);

}

The argument 'flags' defines the way in which the file needs to be opened ie in read-only, write-only or read-write mode. So corresponding to this there are three flags O_RDONLY, O_WRONLY, or O_RDWR to choose from. For second query, any and all .java file input/arg should return error regardless of whether it is present or not. Any .txt file should redirect to "hello.txt"

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions

Question

5. If yes, then why?

Answered: 1 week ago

Question

3. What changes should I be making?

Answered: 1 week ago