|
楼主 |
发表于 2004-5-29 21:39:30
|
显示全部楼层
but i have still a program.
i write an edit with c++,and want to use signal().
the part of my program is like this:
#include "All.h"
#include "Control.h"
#include "StrView.h"
StrView FirstView;
struct winsize GetWinSize()
{
struct winsize size;
if(ioctl(1 , TIOCGWINSZ , (char *)&size) < 0)
{
size.ws_col=0;
size.ws_row=0;
FirstView.DisplayCommand("TIOCGWINSZ error");
}
return size;
}
void SigWinch(int signo)
{
FirstView.WinSize=GetWinSize();
FirstView.Display(*(FirstView.str));
}
void SigAlrm(int signo)
{
}
int main (int argc , char *argv[])
{
try
{
if(argc == 1)
argv=NULL;
Control control(argv , argc);
signal(SIGWINCH , SigWinch);
signal(SIGALRM , SigAlrm);
move(0 , 0);
for(;!control.GetNowExit();)
{
if(control.GetMode() == COMMANDMODE)
control.ReadCommand();
else
control.EditFile();
}
}
catch(FatalError error)
{
cout<<error.GetStr();
}
}
but when i change the size of window,the function SigWinch() is not executed. |
|