Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CHABE2 (4 points-C Program Exclude any existing source code tiles that may alre ady be in your IDE project and add a naming it C1A8E2

image text in transcribed
CHABE2 (4 points-C Program Exclude any existing source code tiles that may alre ady be in your IDE project and add a naming it C1A8E2 main.c. Wite progra m in that file to display the contents of group of lines at a time 2 new one t ne The progra m must get two space-separated arguments trom the commandline prom the file to display and the second specities the number of lnes to display in each group. For exa mple (not from a yser . The first of these arguments specifies the name of 9 command line arguments of TestFile1.txt5 would tell the progra m to display the contents of a file named TestFile1.txt in 5-line groups At the end of each group of lines the progra m must wait for a keyboard entry. If the entry is a ne wlne (the Enter key) the next group of lines must be displayed. If there is less than a complete group of lines re maining to be displayed the pro gram must exit after displaying-them. If the entry is any key other thar Enter followed by Enter the progra m must exit im mediately without displaying any more file lines Before using any command line arguments the-program must venty that exactly the comect number of them exists. If not, an ermor message must be output to stderr and the program terminated with an error exit code. The eor message must indicate the reason for termin a tion I the spe cifie d file fails to open an error message must be output to stderr and the progra terminated with an error exit code. The error message must indicate the reason for termination and mention the na me of the failing file Manually re-run your progra m several times, testing with at le ast instructor-supplied data fle Te which must be placed in the program's"w.orking directory". Try various line count values. Submitting your solution Send your source code file to the Assignment Checker with the subje ct line C1ABE2 ID, where ID is your character UCSD student ID ee the course document titled "Preparing and Sub mitting Your Assignments" for additional exercise rm atting, sub mission, and Assignment Checkerrequirements 1. In C do you know how to convert a string that represents a numeric value into the numeric value 2. EOF cannot be rela bly stored or detected using any torm of data types char or short, use type 3. Since EOF only occurs when a read (or write) is atte mpted, testing for it before that atte mpt ts: it represents? If not, consid er sscanf, atoi, atol, atof, strtol, strtoul, or strtod. int inste ad (Notes 4.3A & 4.38) provides no useful information about what the outcome will be. Only EOF checks done after reading/wnting and before aay values resulting from it are actually used are valid for avoiding data problems. (Note 4.38) riti Not testing files for a successful open is an unacceptable progra mming practice (Notes 10.3 & 10.4B)

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

Students also viewed these Databases questions

Question

What are your businesss key cost drivers?

Answered: 1 week ago