Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

File reading using (head & tail)

Hi all

I have a task to do within one week. I tried to solve it but I did not get the perfect solution.

The task is to read a command line arguments the consists of (progName fileName linesToRead startPosition) OR (progName fileName).
The programs should open the file provided then it should read it for number of linesToRead(i,e: prog test.txt -3) the program should read the first three lines only, similarly for tail. It should read three lines from the bottom of the file.

Pleae if you have any clue for solving such a problem reply to this message as soon as possible.

Thanks in advance

Abdul Hameed

Comments

  • IDKIDK Member Posts: 1,784
    : Hi all
    :
    : I have a task to do within one week. I tried to solve it but I did not get the perfect solution.
    :
    : The task is to read a command line arguments the consists of (progName fileName linesToRead startPosition) OR (progName fileName).
    : The programs should open the file provided then it should read it for number of linesToRead(i,e: prog test.txt -3) the program should read the first three lines only, similarly for tail. It should read three lines from the bottom of the file.
    :
    : Pleae if you have any clue for solving such a problem reply to this message as soon as possible.
    :
    : Thanks in advance
    :
    : Abdul Hameed
    :

    You didn't mention any problem, only a task. Do the task and then post the problems you encounter with it.

    If you want to do something similar to tial, then look at the source for tail.
Sign In or Register to comment.