1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| #include "stdafx.h"
#include <stdio.h>
#include <process.h>
#include <Windows.h>
int main(int argc, char* argv[])
{
char lp[100];
int sz;
char lpszShortPath[100];
HANDLE hFile;
//
hFile = CreateFile("RELOAD.TXT",
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
printf ("le serveur n'a pas redemarré");
return 0;
}
strcpy(lp, "C:\\Program Files\\Apache Software Foundation\\Apache2.2\\bin\\");
sz=GetShortPathName((LPSTR)lp, (LPSTR)lpszShortPath, sizeof(lpszShortPath));
//
strcat((LPSTR)lpszShortPath, "httpd -k restart");
//
printf ("%s\n", lpszShortPath);
//
system( (LPSTR)lpszShortPath );
//
CloseHandle(hFile);
DeleteFile("RELOAD.TXT");
//
return 1;
} |
Partager