0 Replies - 800 Views - Last Post: 27 April 2008 - 03:11 AM

#1 aamir_mustafa2007@msn.com  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 03-July 07

operating systems

Post icon  Posted 27 April 2008 - 03:11 AM

What would be the output of the following code segment, if the current working directory contains the following files and directories: .bashrc, .profile, .private, test.c, main.c, courses, personal. (5 marks)

main()
{
pid_t childpid;

childpid = fork();
if (childpid == -1) {
printf(“fork failed.\n”);
exit(1);
}
if (childpid == 0) {
if (execlp (“/bin/ls”, “ls ./”, NULL) < 0) {
printf(“exec failed.\n”);
exit(1);
}
}
}

Is This A Good Question/Topic? 0
  • +

Page 1 of 1