#include <iostream>
#include <fstream>
#include <signal.h>
#include <windows.h>

using namespace std;

typedef int pid_t;

int mingw_kill(pid_t pid, int sig)
{
	if (pid > 0 && sig == SIGTERM) {
		HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, pid);

		if (TerminateProcess(h, -1)) {
			CloseHandle(h);
			return 0;
		}

		CloseHandle(h);
		//errno = err_win_to_posix(GetLastError());
		return -1;
	}
	errno = EINVAL;
	return -1;
}


int
main()
{
   ifstream fin("c:\\development\\cgid\\cgid\\pid.txt");
   if(fin) {
      int pid;

      fin >> pid;

      fin.close();

      mingw_kill(pid, SIGTERM);
   }
   return 0;
}