Welcome, Guest. Please login or register.

Author Topic: while & ctrl+c . 'break' signal.  (Read 2774 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline kas1eTopic starter

while & ctrl+c . 'break' signal.
« on: November 26, 2004, 12:52:49 PM »
hi all. i have little question about ctrl+c and 'break' handling. sas/c compiler used. so:

main()
{
  while(1)
      {
           if (CheckSignal(SIGBREAKF_CTRL_C))
               {exit(0);};
       }
}


if i press ctrl+c in cli, all ok, and 'status' command said
that not load program. but if i kill my programm by 'break'
command, 'status' said: Proccess 1: No command loaded. but anyway process present. how i must handler 'break' in my whyle loop for good killing by 'break' ?
 

Offline kas1eTopic starter

Re: while & ctrl+c . 'break' signal.
« Reply #1 on: November 26, 2004, 06:30:11 PM »
>I hope your real code dosn't busy-wait like the fragment above.

i recv() from socket in while. and test on ctrl+c:
while(recv(.....))
{
  .........
  ctrl+c();
  .........
}

>Well, which AmigaOS and which compiler do you use ?
3.9bb2, sasc/vbcc.

>What does your CheckSignal function do ?
it's not my, it's from dos.library():

NAME
   CheckSignal -- Checks for break signals (V36)

FUNCTION
   This function checks to see if any signals specified in the mask have been set and if so, returns them. Otherwise it returns FALSE.All signals specified in mask will be cleared.


i don't now, who preferred Wait() or CheckSignal().. btw, thnx for answer, it was 2 open shells :) so, all is ok.



btw, maybe you know what i can redirect all 'cli' output to
file or memory ? i mean:

char buf[500];

SystemTags("newcli",???); // cli start, but output redirect
                          // to buf[];

?
 

Offline kas1eTopic starter

Re: while & ctrl+c . 'break' signal.
« Reply #2 on: November 26, 2004, 09:17:19 PM »
i can create tmp file in memory ? i mean, i not want create file on hdd. (in ram: too, becouse name of file will be anyway). maybe here is some flag for 'memory file' ?