Course Solutions Uncategorized (Solved) : Following Cpp Program Change Content Appends Every File Directory Name Recursively Current Q26839225 . . . .

(Solved) : Following Cpp Program Change Content Appends Every File Directory Name Recursively Current Q26839225 . . . .

 

For the following .cpp program, change the content such that itappends ‘a’ to every file and directory name recursively in thecurrent working directory and sub directories.

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

#include <unistd.h>

#include <stdio.h>

#include <stdlib.h>

#include <dirent.h>

#include <limits.h> // for PATH_MAX

#include <string.h>

/* function type that is called for each filename */

typedef int Myfunc(const char *, const struct stat *, int);

static Myfunc myfunc;

static int myftw(char *, Myfunc *);

static int dopath(Myfunc *);

static long nreg, ndir, nblk, nchr, nfifo, nslink, nsock,ntot;

int

main(int argc, char *argv[])

{

int ret;

if (argc != 2)

printf (“usage: ftw <starting-pathname>”);

ret = myftw(argv[1], myfunc); /* does it all */

ntot = nreg + ndir + nblk + nchr

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post