By liran bh | 11/15/2016 | Linux User Space

Linux files exercises

  1. Write a program to emulate the behaviour of the Unix cat command as follows:

    If no command line arguments are given, the program should write its standard input to its standard output. If arguments are given, then treat them as filenames and copy the contents of each in turn to standard output.

    Solution is in sol/mycat.c

  2.  You will notice that if you give a directory name as an argument to your program for question 1, then an error will occur or garbage will be displayed (the exact symptoms differs between operating systems).

    Modify your program from question 1 so that it detects the fact that a directory has been chosen, and report a suitable error message to the user.

    Solution is in sol/mycat2.c

{{CommentsModel.TotalCount}} Comments

Your Comment

{{CommentsModel.Message}}

Recent Stories

Top DiscoverSDK Experts

User photo
3355
Ashton Torrence
Web and Windows developer
GUI | Web and 11 more
View Profile
User photo
3220
Mendy Bennett
Experienced with Ad network & Ad servers.
Mobile | Ad Networks and 1 more
View Profile
User photo
3060
Karen Fitzgerald
7 years in Cross-Platform development.
Mobile | Cross Platform Frameworks
View Profile
Show All
X

Compare Products

Select up to three two products to compare by clicking on the compare icon () of each product.

{{compareToolModel.Error}}

Now comparing:

{{product.ProductName | createSubstring:25}} X
Compare Now