Why do the values read by parent not written in the process called by excel?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

#define MAXLINE 256
#define MAX_PASSWORD 10
#define SUCCESS "Password verified\n"
#define INVALID "Invalid password\n"
#define NO_USER "No such user\n"

int main(void) {
  char user_id[MAXLINE];
  char password[MAXLINE];
  int ret;
  int status;

  /* The user will type in a user name on one line followed by a password 
     on the next.
     DO NOT add any prompts.  The only output of this program will be one 
	 of the messages defined above.
     Please read the comments in validate carefully
   */

  if(fgets(user_id, MAXLINE, stdin) == NULL) {
      perror("fgets");
      exit(1);
  }
  if(fgets(password, MAXLINE, stdin) == NULL) {
      perror("fgets");
      exit(1);
  }
  if(strlen(user_id) > MAX_PASSWORD) {
    printf(NO_USER);
    exit(3);
  }
  if(strlen(password) > MAX_PASSWORD) {
    printf(INVALID);
    exit(2);
  }

  int fd[2];
    if (pipe(fd) == -1) {
      perror("pipe");
    }

  ret = fork();
  if (ret > 0) {
    if ((dup2(fd[1], fileno(stdout))) == -1) {
      perror("dup2");
      exit(1);
    }
    if ((close(fd[0])) == -1) {
      perror("close");
    }
    if ((close(fd[1])) == -1) {
      perror("close");
    }
  } else if (ret == 0) {
    if ((dup2(fd[0], fileno(stdin))) == -1) {
      perror("dup2");
      exit(1);
    }
    if ((close(fd[0])) == -1) {
      perror("close");
    }
    if ((close(fd[1])) == -1) {
      perror("close");
    }
    execl("./validate", "validate", NULL);
  } else {
    perror("fork");
    exit(1);
  }
  printf("start wait\n");
  wait(&status);
  printf("wait end\n");
  printf("%d",WEXITSTATUS(status));
  if(WEXITSTATUS(status) == 0) {
    printf(SUCCESS);
  }
  if(WEXITSTATUS(status) == 2) {
    printf(INVALID);
  }
  if(WEXITSTATUS(status) == 3) {
    printf(NO_USER);
  }
  printf("end\n");
  
  return 0;
}
