Unix Exp
Unix Exp
NO:
Date: Experiment-3 Page No:
a) Write a C program that makes a copy of a file using standard I/O, and system call
Program:
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int f1, f2; char
buff[50]; long int
n;
if(n==-1)
{
perror("problem in reading");
exit(2);
}
close(f2);
Output:
c) Write a C program that illustrates how to execute two commands concurrently with a
command pipe. Ex: - ls –l | sort.
Program:
#include<stdio.h>
#include<fontl.h>
#include<sys/stat.h>
Output: