Solved–Project 1– Solution

$35.00 $24.00

turnin code: cs_p1 Write a C program that takes a single command-line argument. If the argument is -hw you should simply print hello world and then exit(0). Otherwise, treat the command-line argument as a filename. Your program should produce the same output as the xxd program if it were given that same filename as its…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

turnin code: cs_p1

Write a C program that takes a single command-line argument.

If the argument is

-hw

you should simply print

hello world

and then exit(0).

Otherwise, treat the command-line argument as a filename. Your program

should produce the same output as the xxd program if it were given that

same filename as its single command-line arg.

A sample test would look like this:

./p1 some_filename

and would produce the same output as this:

xxd some_filename

Note that the C function isprint(3) could prove quite useful here.

Also note, that the language used by the textbook and in this class

are C without the C++ extensions.

To test the project, it will be run like this:

./p1 filename ## I may do this for multiple filenames

TURNIN info:

You should submit a tar file of a directory which contains all of the

required files (makefile, C source files, header files, etc).

Sample tar command to create a tar file from a dir:

tar cvf p1.tar ./p1dir ## do *NOT* use full pathname of the dir

Sample un-tar, build, and simple execution will be provided in a script

in p1testfiles/PREP.