CS253: Software Development with C++

Spring 2018

HW 3

CS253 HW3: Options & Unserialization                

Description                

Write a C++ program called hw3 that behaves like HW2, except that it accepts command-line options:                 

-s
serialize: the default behavior, similar to HW2
-u
unserialize: convert from serialized format (like HW2’s output) to unserialized format (like HW2’s input)
-v
verbosely announce each file, just before attempting to open it, to stderr, in this manner:
        Processing file filename-goes-here

Terminology                

"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.                 

Booleans                

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.                 

Sample Runs                

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
    %

Hints                

Debugging                

If you encounter “STACK FRAME LINK OVERFLOW”, then try this:

    export STACK_FRAME_LINK_OVERRIDE=ffff-ad921d60486366258809553a3db49a4a

Requirements                

The requirements are the same as those for HW2, plus:                 

Ask                

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.                 

Tar file                

How to submit your homework:                

    ~cs253/bin/checkin HW3 hw3.tar

How to receive negative points:                

Turn in someone else’s work.                 

User: Guest                 

Check: HTML CSS
Edit History Source

Modified: 2018-04-02T17:06                 

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building