Sie sind auf Seite 1von 2

Programming Assignment: 1 Instructions:

Attempt any 4 of the following. Each question carries 2 marks. Attempting all 9 questions will qualify you for bonus mark during final grading. Please note that this is an individual assignment. You should submit your own work.. Any cheating or collaboration will be punished severely. If any two submitted assignments happen to be identical, both will lose the mark of the assignment totally. The submission date for this assignment is Saturday 19th May before 5PM online using your moodle account. Please note that this is a deadline, not a guideline: No extensions will be given. When you have finished, you should submit the .c file (for e.g: pgm1.c). In the C file add a comment at the beginning with your name and ID. This has to be followed by another comment with the respective question. After that your C source code. Finally your output as another comment at the bottom. E.g: Format //Name:.Reg No:. /*Question1:. ..*/ //Source Code:
. .. /* Output .. .. */

Failure to submit in the above format will not bee taken for grading. Your mark from this assignment will make a part of Lab 10%, of your final mark for this course.

1. A simple program to programmatically invoke the executables shell, ps and any c program exe using fork and exec system calls in GNU/LINUX. 2. A program to print the size, i-node number and owner id of any file in GNU/Linux. Enter the path of the file as input. 3. A program to get the complete information of the user using getpwuid system call in GNU/Linux. 4. A simple guide to write programs which can be made use only by a specific user in a GNU/Linux system using getuid and getlogin system calls. 5. A program to print the user ID and username in GNU/Linux using getuid and getlogin system calls. 6. A program in GNU/Linux to get time of 5 countries using gmtime and time system call. 7. An illustration program of sleep system call in GNU/Linux 8. An illustration program of time, difftime and sleep system call in GNU/Linux. 9. Use popen() and cat process to read any file and display on the standard output.
[The standard I/O library provides a function popen() that creates a pipe and initiates another process that either reads from the pipe or writes to the pipe. Syntax: #include<stdio.h> FILE *popen (char *command, char *type); The function pclose()Closes an I/O stream that was created by popen() #include <stdio.h> int pclose(FILE *stream);]

Das könnte Ihnen auch gefallen