
code:
/*
* usage: ./a.out input_file text_pattern
* Executes the command “cat input_file | grep text_pattern | cut -b1-10”.
* Note only minimal error checking is done for simplicity/shortnessof code.
*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
int main(int argc, char **argv)
{
int status;
int i;
if (argc == 3)
{
// arguments for commands
char *cat_args[] = {“cat”, argv[1],NULL};
char *grep_args[] = {“grep”,argv[2], NULL};
char *cut_args[] = {“cut”, “-b”,”1-10″, NULL};
// file descriptors for 2 pipes:fd1 for
PayPal Gateway not configured
PayPal Gateway not configured