Write a C++ program called hw3
that behaves like HW2,
except that it accepts command-line options:
                
-s
-u
-v
Processing file filename-goes-here
"Unserialized" data refers to human-readable form, e.g.,
42
, 'x'
, "Moriarty"
.
                
"Serialized" data refers to tagged hexadecimal data. In the future, we may represent serialized data more efficiently.                 
It is now possible to serialize boolean values.
They are represented as the words true
& false
in unserialized
format.
In serialized format, their tag characters are t
& f
,
with no data following, because t
& f
say it all.
                
Here are some sample runs. “%” is my prompt:                 
% cat sample-input 5 300 -1 1 2 -3 40 500 -6000 70000 false 1000000000 'a' 'b' ' ' "Jack Applin" % ./hw3 -s sample-input 73 05 73 11 2c 73 0f 73 01 73 02 73 0d 73 10 28 73 11 f4 73 2f e8 90 69 21 11 70 66 69 40 3b 9a ca 00 63 61 63 62 63 20 53 10 0b 4a 61 63 6b 20 41 70 70 6c 69 6e % ./hw3 -v sample-input >serialized Processing file sample-input % ./hw3 -u serialized 5 300 -1 1 2 -3 40 500 -6000 70000 false 1000000000 'a' 'b' ' ' "Jack Applin" % cat ugly 73 01 73 02 73 03 73 04 % ./hw3 -vu -vuv -v ugly Processing file ugly 1 2 3 4 %
int n; cin >> hex >> n;
If you encounter “STACK FRAME LINK OVERFLOW”, then try this:
export STACK_FRAME_LINK_OVERRIDE=ffff-ad921d60486366258809553a3db49a4a
The requirements are the same as those for HW2, plus:                 
./hw3 datafile -u
will
attempt to read the file -u
, which would probably fail.
-s
and -u
.
./hw3 -sv file1 file2
is the same as ./hw3 -s -v file1 file2
.
program_name
to facilitate displaying the
program name from argv[0]
in error messages.
If you have any questions about the requirements, ask. In the real world, your programming tasks will almost always be vague and incompletely specified. Same here.                 
hw3.tar
*.cc
)
*.h
) (if any)
Makefile
, with a capital M
)
Makefile
’s default target must create the executable file
hw3
.
Makefile
must use at least -Wall
when compiling.
~cs253/bin/checkin HW3 hw3.tar
Turn in someone else’s work.                 
User: Guest