Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Having trouble writing this small C program: A program written in C (NOT C++) that needs to accept command line arguments (see below) should reverse

Having trouble writing this small C program:

A program written in C (NOT C++) that needs to accept command line arguments (see below) should reverse the order of bytes read, and output the bytes in reverse order. To make this program more manageable, bytes should be processed in blocks of less than 1k characters (block size is a parameter and can be changed by user command line argument). For example, if the block size is 4 and the data is abcdefghijkl, the blocks to be reversed would be abcd, efgh, ijkl, and output should be dcbahgfelkji.

The program should process the following optional command line arguments (user's option - required for program): -i ...for the input file name (default: stdin) -o ...for the output file name (default: stdout) -b ...for the number of characters in a block to reverse (default: 10)

REQUIREMENT: Use only system calls for all input and output operations (write, read, open, close, etc.), including any error messages that may be output (sent to stderr). The data should be from either a file or stdin and the output should be to either a file or stdout.

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_2

Step: 3

blur-text-image_3

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

Data Science For Dummies

Authors: Lillian Pierson ,Jake Porway

2nd Edition

1119327636, 978-1119327639

More Books

Students also viewed these Databases questions

Question

3. Identify challenges to good listening and their remedies

Answered: 1 week ago

Question

4. Identify ethical factors in the listening process

Answered: 1 week ago