home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.disi.unige.it
/
2015-02-11.ftp.disi.unige.it.tar
/
ftp.disi.unige.it
/
pub
/
.person
/
GianuzziV
/
SO1
/
WSignal.cpp
< prev
Wrap
C/C++ Source or Header
|
2001-11-11
|
740b
|
38 lines
// IntrC.cpp
#include "stdafx.h"
#include "IntrC.h"
#include "process.h"
#include "signal.h"
void intr_ctrC(int sig) // catch ^C and end on request
{
char ch[2];
signal(SIGINT, intr_ctrC); // catch ^C
printf("Do you really want to abort? (y) > ");
scanf("%s", ch);
if ('y'==ch[0]) exit(1);
return;
}
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
printf("Fatal Error: MFC initialization failed\n");
exit(1);
}
signal(SIGINT, intr_ctrC); // catch ^C
for (;;)
{
printf("sto lavorando per voi \n");
Sleep(1000);
}
return 0;
}