Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started