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 that accepts command line arguments (see below) should reverse the order of bytes

Having trouble writing this small C program:

A program written in C that accepts 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

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions