Question: Using system calls you have learned so far, build your own command called fpart to display (or echo) a portion of any text file. Please


Using system calls you have learned so far, build your own command called fpart to display (or echo) a portion of any text file. Please follow the following requirements 1. Your command must be typed in these styles a. fpart filename.txt start byte end _byte b. fpart filename.txt start_byte 2. If the input file (filename.txt) is a non-text file, then a message must be displayed like this: Input file is not a text file 3. Here is an example run. Assume your input text file is like this: (file name story.txt) One night, three thieves stole a lot of money from a rich man's house. They put the money in a bag and went to the forest. They felt very hungry. So, one of them went to a nearby village to buy food. The other two remained in the forest to take care of the bag of money. The thief that went for food had an evil idea. He ate his food at a hotel. Then he bought food for his two mates in the forest. He mixed a strong poison with the food. He thought, "Those two will eat this poisoned food and die. Then I will get all the money for myself." Meanwhile, the two wicked men in the forest decided to kill their mate on return. They thought that they would divide the money between the two of them. All the three wicked men carried out their cruel plans. 7he thief who wanted all the money for himself came to the forest with the poisoned food. The two men in the forest hit him and killed him. Then they ate the poisoned food and died. Thus, these evil people met with n evil end You run the command like this: Example 1 $fpart story.txt 10 100 , three thieves stole a lot of money from a rich man's house. They put the money in a bag a The output about printed out the byte 10 to 100 of the text file. Example 2 $fpart story.txt 500 Then I will get all the money for myself." Meanwhile, the two wicked men in the forest decided to kill their mate on return. They thought that they would divide the money between the two of them. All the three wicked men carried out their cruel plans. The thief who wanted all the money for himself came to the forest with the poisoned food. The two men in the forest hit him and killed him. Then they ate the poisoned food and died. Thus, these evil people met with an evil end. In the above example, all text starting from the 500th byte is printed on the screen See next page for some more example scenarios
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
