Write the code to read a file name infile and then print


1) Write the code to read a file name inFile and then print every record read to stdout. Provide for a graceful exit in the event the file cannot be found or opened. Declare the variables needed for the file pointer and the input buffer. Assume that all lines read are plain text terminated by a newline character.

2) Assume that a text string is passed as the first paramter. Include a 50 character buffer named filenameBuf to hold the first parameter. Write the code to create the buffer and copy the first command line argument into the buffer.

3) Assume that the second and third command line parameters are integers. Write the code to get those integers from the command line and add them together, printing the result to stdout. Assume the prior declaration of integers named a, b, and total.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write the code to read a file name infile and then print
Reference No:- TGS02711925

Now Priced at $15 (50% Discount)

Recommended (93%)

Rated (4.5/5)