Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the existing code to output the above output, WRITE IN C PLEASE: #include #include #include #include #include #include #define LINESIZE 16 //use one command

image text in transcribedimage text in transcribed

Modify the existing code to output the above output, WRITE IN C PLEASE:

#include #include #include #include #include #include

#define LINESIZE 16

//use one command line argument int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: diagonal "); return -1; }

//create a file so that 16 rows of empty will appear with od -c command int fd = open("diagonal.out", O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR); char space = ' '; for(int line=0; line

//Each line of od outputs 16 characters //So, to make the output diagonal, we will use 0, 17, 34, .... int n = strlen(argv[1]); for(int i=0; i { cslinux1: /linux7/a6\} make diagonal { cslinux1: /linux7/a6\} diagonal Funny! diagonal.out has been created. Use od -c diagonal.out to see the contents. { cslinux1: /linux7/a6\} od -c diagonal.out Now, enhance it to handle any \# of words as parameters and output them in a fancy pattern as shown below - use a block of 1616 characters for each word. Note that 1616=256 (decimal) =400 (octal). Save the new program as diagonal2.c { cslinux1: /1lnux7/a6} make diagonal2 { cslinux1: /1inux 7/a6} diagona12 Jey Veerasamy Professor UTDa11as diagonal2, out has been created. Use od -c diagonal2, out to see the contents. { cslinux1: /1inux 7/a6} od c diagonal2.out<>

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

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

2 What are the implications for logistics strategy?

Answered: 1 week ago