Re: Use of alarm() with 4gl code
Posted in 1997
>Date: Thu, 22 May 97 15:29:37 MET >From: Marco Greco <marcog@ctonline.it> >X-Informix-List-Id: <list.14602> > >I would like to use a timer within a number of 4gl (works!) applications >to trigger actions if the user hasn't pressed a key in some time. >Alarm(), of course, is a likely candidate, so I have already strolled to >the IIUG sw archives and downloaded timeout.Z. Works nicely. Since this >is a request that crops up every so often (last time being some two months >ago), I vaguely remember Jonathan saying that alarm() is internally used >by INPUT (and I suspect INPUT ARRAY, DISPLAY ARRAY and CONSTRUCT too). I hope I said it is used during input (lower case), meaning while waiting for keyboard input from the user. This would cover INPUT, INPUT ARRAY, DISPLAY ARRAY and CONSTRUCT. It also covers PROMPT and MENU and maybe others too. About the only interaction that is excluded is the keyboard reading for PAUSE in a report -- and I'm not sure whether that uses the same function or not. >Fair enough. I will only be using alarm() while waiting for rgetkey() >(for the unaware, an undocumented function that reads characters from the >standard input) to return chars. For the unaware, rgetkey() calls down onto the code that messes around with alarm(). >Can somebody confirm that this will (probably!) work irrespective of the 4gl >wersion used? Anybody who confirms that is probably fibbing. It won't work reliably, because rgetkey() and friends use alarm(). You may be OK if users don't go messing with function keys when your code is reading the input, but it is not reliable. Also, using rgetkey() means that other I4GL functions such as fgl_lastkey() won't know what was typed. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>