Write your own version of wc

Assignment Help C/C++ Programming
Reference no: EM131137823

This program needs to be written in C. wc is another standard UNIX command for counting the number of lines, words, and characters in a text file.

Now that we know how to read files, you're going to write your own version of wc. Your program is to receive a text file as a command line argument and then count and display the number of lines and characters in that text file.

Assume a line is a newline character.

Sample Run: Command Prompt$ ./a.out file.txt Lines: 2 Characters: 23 Where file.txt contains: hello how are you? rawr

Reference no: EM131137823

Questions Cloud

Write a program that takes four command line arguments : Write a program that takes four command line arguments: start, stop, step, and file. The first three arguments are nonnegative integers and the fourth is a string.
Calculate the hydraulic conductivity of this clay : A falling-head permeability test was carried out on a clay soil of diameter 10 cm and length 15 cm. In 1 hour the head in the standpipe of diameter 5 mm dropped from 68 cm to 50.2 cm.
What effect do the closing costs have on the effective a i r : The bank charges $4,000 for closing costs on a $200,000 loan with an annual percentage rate of 8.5% compounded monthly with a term of thirty years. The bank will not allow the closing costs to be added to the $200,000 borrowed. What effect do the clo..
Draw an as ad diagram : The Economy cannot be considered fully employed unless the measured unemployment rate is below 1%. Agree or disagree and explain your answer in a paragraph.
Write your own version of wc : Write your own version of wc. Your program is to receive a text file as a command line argument and then count and display the number of lines and characters in that text file.
Determine the flow (qi) into the excavation : The excavation has to be kept dry. Determine the flow (qi) into the excavation
How much interest is paid over the life of the loan : How much interest do the borrowers in Problem 12 pay during the second year of the loan? In Problem 12, determine the monthly payment for a sixty-month truck loan with an annual percentage rate of 11% and an initial principal of $17,000. How much int..
What subjective factors would affect investment decision : Assume that the before-tax required rate of return for Deer Valley is 14%. Compute the before-tax NPV of the new lift and advise the managers of Deer Valley about whether adding the lift will be a profitable investment
Which data is at the bottom of the heap : Which data is at the bottom of the heap - Now remove the 2, 3, and 4, from your heap in above question, then which data is at the root:?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Use functional decomposition to solve

Use functional decomposition to solve this problem, and code the solution using functions wherever it makes sense to do so. Your program should check for invalid data such as nonpositive dimensions, number of rooms less than 1.

  What output is produced by the following program

What output is produced by the following program?

  Explain what the following code does

Explain what the following code does?

  Using the following program as a guide

Using the following program as a guide, write a program reads in 2 scores in the main function.. Calls a function that will triple each number. In the function and the print the result in the main function.

  Construct the wait-for graph

P2 waits for 2 units of R1 and holds 1 unit of R2, P3 holds 2 units of R3 and waits for 1 unit of R4, P4 holds 2 units of R3 and waits for 1 unit of R4. Construct the wait-for graph. Does the system have a deadlock? Justify your answer

  Microsoft project file work breakdown structure

Update the Microsoft Project file you created in (Work Breakdown Structure) with the following changes.

  Program that declares three single dimensional arrays

In the gallons array store the numbers 10.3, 15.7, 14.9, 10.7 and 8.4. Each element of the mpg array should be calculated as the corresponding element of the miles array divided by the equivalent element gallons array; for example mpg[0] = miles [..

  Define a 2-element array of characters

Write an if statement that sets the variable age to 21 when the flag variable adult is set and define a 2-element array of characters named alpha initialized with the characters P, Q.

  Once the user enters a 0

Once the user enters a 0 you will exit the loop, close the file and execute the code as previously designed until you have displayed all of the scores and the average handicap.

  Create a loop to print a table with all the characters

Create a loop to print a table with all the characters in the user's full name and their corresponding ASCII value. You may use the charAt() method of the String class to identify each of the characters in the full name and type cast them as int t..

  Calculates the exact integral over the interval

Write your program so that it outputs the interval entered, the exact solution, the approximation, the number of trapezoids and the difference between the exact and approximate solutions - trapezoids increases the approximate result converges to th..

  Rationalnumber class a rational number is a number that can

rationalnumber class a rational number is a number that can be represented as the quotient of two nbspintegers. for

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd