Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Base 6 4 In this assignment, you will write a simple base 6 4 encoding utility to familiarize yourself with the basics of C programming.

Base 64
In this assignment, you will write a simple base64 encoding utility to familiarize yourself with the basics of C
programming. You will be using, exclusively, a small subset of the C standard library to accomplish this task. You will
practice:
Parsing command-line arguments
Using the standard io library features
Handling errors
Manipulating data and working with arrays
Learning Outcomes
How to write a C program to solve a problem? (Module 1 MLO 4)
How can programs invoke OS services using system calls? (Module 1 MLO 5)
How do you interact with the user in C programs? (Module 1 MLO 6)
How are C programs transformed into an executable form? (Module 1 MLO 7)
a Specification
NAME
base64- Base64 encode data and print to standard output
SYNOPSIS
base 64[FILE]
DESCRIPTION
Base 64 encode FILE, or standard input, and output to standard output.
With no FILE, or if FILE is -, read from standard input.
Encoded lines are wrapped every 76 characters.
The data are encoded according to the standard algorithm and standard base 64 alphabet described in RFC
4648?.
STDIN
The standard input shall be used only if no FILE operand is specified, or if the FILE operand is -.
STDOUT
The standard output shall contain the base 64 encoded output, wrapped to 76 characters.
STDERR
The standard error shall be used only for error reporting. All errors must be reported to standard error.
EXIT STATUS
0, if successful.
>0, if an error occurs.
Additional Requirements
Your program may not use Variable Length Arrays (VLAs), which are declared with a non-constant expression as
the array size (e.g. char input [n]). The compiler option - Werror=vla will prevent compilation with VLAs.
Your program must compile against the c99 standard, using the compiler option -std=c99.
In other words,
gcc - std=c99-Werror=vla - o base 64dots
The provided makefile compiles with the appropriate options, and you do not need to modify it,
$ make -B release
gcc -std=c99-Wall -Werror=vla -Werror -03-c -o build/release/base64.o src/base 64.c
gcc -o build/release/base 64 build/release/base 64.0
$ make -B debug
gcc -std=c99-Wall -Werror=vla -g-c-obuilddebugbase64.0srcbase64.c
gcc -0build? debug/base 64 build/debug/base 64.o
Gradescope will compile your program using its own copy of the makefile; you need only to upload your *.c source
files and nothing else.
Additionally, your program must run in constant space complexity while accepting input of any arbitrary length. In
other words, you may not dynamically allocate memory. The idea is that your program will process input in small
chunks, until reaching end of input. Do not attempt to buffer the entire input before encoding it. If found to violate this
requirement, you will receive a 0.
When exiting due to an error, your program must print an informative error message to the standard error stream,
stder r and exit with a non-zero exit status. You are encouraged to use the convenience function err (int
exit_val, char const "fmt,...) exposed by the
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

1. What are the critical issues in this case description?

Answered: 1 week ago

Question

2. What factors infl uence our perceptions?

Answered: 1 week ago

Question

4. Does mind reading help or hinder communication?

Answered: 1 week ago