Lab 3: Structs

The goal of this lab is to learn basic C structs.

1. Introduction

You are writing software for a Twitter knock-off called Chatter. In the Chatter system, users send messages at most 140 characters long. Additionally, each message has the user id of the user who sent the message (at most 16 characters long), a time stamp indicating the time the message was sent (a long int indicating the number of milliseconds since midnight, Jan 1, 1970), and up to 5 hash codes indicating categories or topics the message falls under (each hash code is at most 10 characters long).

I have provided some code for producing "random" text components and "random" user names. Your tasks will include designing and implementing a struct to represent messages, writing functions for displaying and sorting messages, and completing drivers to test these messages.

2. Set up

Set up a new directory for this lab and move into it.

mkdir lab3
cd lab3

Copy starter code from the course directory.

cp /homes/tvandrun/Public/cs245/lab3/* .

3. Given code

The chatterUtil library provides the following functions:

4. Tasks

You need to complete the following tasks:

5. Pretty displaying of the time (optional)

If you want to make a readable formatting of the time stamp, do the following things to your code:

Then the display of a message would look something like

-----------------------
Sent by Willis at Thu Sep  8 12:32:37 2011

Q: Why do elephants stomp on people?
A: They like the squishy feeling between their toes.
#surplus
#moisture

Thomas VanDrunen
Last modified: Thu Sep 8 12:33:38 CDT 2011