正直なところ、ここで何が起こっているのかわかりませんが、ここに私の説明があります>
ファイル名の配列を保持するために文字列の配列をmallocしますが、問題ありません。次に while ループに移動し、これに到達して時刻を出力するまで、すべての正しい値を保持します
time(&rawtime);
printf("It is now: %s\n\n",ctime(&rawtime)); 
それから私の価値観はなくなりました。それらをどこにも見つけることができません。空の配列があるようです。
ここに残りのコードがあります
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <limits.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
  int i,j, directSize,start=0,flag=0, menu;
  size_t size;
  char path[1024];  //current working directory path
  char ** files;    //created to store the directory contents in an array of strings
  char buffer ;     //buffer holds menu selection
  time_t rawtime;
  //buffer = (char*) malloc(sizeof(char));
  files = (char**) malloc(sizeof(char*)+1);
  //allocating memory for strings
  for(i=0;i<50;i++)
  {
    files[i] =(char*) malloc(64*sizeof(char));
  }
  getcwd(path,size);
  pid_t child;
  DIR * d;
  struct dirent *de;
  d = opendir(".");
  i=0;
  while((de = readdir(d)))
  {
    files[i] = de->d_name;
    i++;
  }
  directSize = i;
  closedir(d);
  printf("file[0]: %s",files[0]);
  while(flag == 0)
  {
    printf("\nfiles[0]: %s\n",files[0]);    //works 
    printf("Current Working directory: %s\n", path);
    printf("\nfiles[0]: %s\nSize: %d\n",files[0],directSize);   //works
    time(&rawtime);
    printf("It is now: %s\n\n",ctime(&rawtime)); //problem area? 
    printf("files[0]: %s\nSize: %d\n",files[0],directSize);     //doesn't work
    printf("Files:\t\t0. (..)\n");
    for(i=start;i<start+4;i++)
      printf("\t\t%d. %s \n",i+1, files[i]);
    //formatted print for the command menu 
    printf("\nOperation:\tV View\n\t\tR Run\n\t\tP Previous Files\tN Next Files\n\t\tX Exit\t\t\tH Help\n");
    printf("\nCommand: ");
    scanf("%c", &buffer);
    getchar();
    //if(isalpha(buffer))
    //  strcpy(buffer,toupper(buffer));
    printf("command chosen is: %c\n",buffer);
    //if(buffer != "N" && buffer != "P" && buffer != "X")
    //{
    //  printf("File/Directory #: ");
    //  scanf("%d", &menu);
    //}
    if(buffer == 'E' || buffer == 'e')
      flag=flag+ 1; 
  }
  return 0;
}