Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include #include #include #include #include #include struct stat stat1; int main(){ char *type,*readok,*execok,*writeok; char line[40],buf[100]; bzero(buf,100); char filename[50]; struct stat stat1; int fp; printf(enter
#include
#include
#include
#include
#include
#include
#include
struct stat stat1;
int main(){ char *type,*readok,*execok,*writeok; char line[40],buf[100]; bzero(buf,100); char filename[50]; struct stat stat1; int fp; printf("enter a file name : "); scanf("%s" , filename); if (stat(filename, &stat1)
lseek(fp,0,SEEK_END); bzero(buf,100); read(fp,buf,100); write(1,buf,100); } close(fp); return 0; }
I have the code and I need to make it as question 8 please help me with this (in C programming language and Unix systems)
C. Run the executat e ne an n 8- Write a C program that reads from the user a name of a file and a directory path. Then the program should search in the path given whether the file name is found or not. If there exists a file with the same name, the program should also check if both files have the same contents. The program outputs the following messages in the following cases: If the found file has a complete match: "Complete match" . If only the name matches: "Name match" If the file not found: "File not found." Also the program checks for all possible errors and mistakes and display correct error messages. Do not use any Unix commands in your code. Save your file as as "lab and "lab07d.h" d. Add the source files to the report. e. Compile and link the source file to get the executable file "lab07d". Show the commands and clear you have used in your report Run the executable file several times for all the cases and show the output in the report. f. 3 | P a geStep 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