/*
// $Id$
//
// AUTHOR : Charles C. Bundy IV
// FILE   : writepid.c
// SUMMARY: This is part 2 of 2 parts.  This subroutine 
//          writes the current PID to the file 
//          referenced by the "outfile" char * 
//          parameter.
*/

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int writePID(char * outfile)
{
FILE   *outfp;
pid_t  MyPID;
char   *RCSID;
char   pidstr[8];

   MyPID = getpid();
   sprintf(pidstr,"%d", MyPID);
   outfp = fopen(outfile,"w");
   if (outfp != NULL)
   {
      fprintf(outfp,"%s", pidstr);
      fclose(outfp);
      return 0;
   }
   RCSID = "$Id$";
   return 1;
}
