Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started