Design and implement a program to display each directory entry information (files and directories) of current directory, and with "chdir" call to change (current working directory) to its subdirectory.

Respuesta :

Answer: The code below can display directory as stated in the question

Explanation:

char *

gnu_getcwd ()

{

 size_t size = 100;

 while (1)

   {

     char *buffer = (char *) xmalloc (size);

     if (getcwd (buffer, size) == buffer)

return buffer;

     free (buffer);

     if (errno != ERANGE)

       return 0;

     size *= 2;

   }

}