home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Tools / nShell™ 1.0.3 / src / Programmer's Guide / 06 Callbacks - Stdin < prev    next >
Encoding:
Text File  |  1994-09-04  |  2.1 KB  |  72 lines  |  [TEXT/ttxt]

  1. 06 Callbacks - Stdin
  2. ====================
  3.  
  4. These routines poll the Standard Input queue.  If keys are expected from the keyboard but none are available (return value = 0), control must be returned to the nShell application to allow processing.  Subsequent calls to Stdin routines will contain the new keystrokes.
  5.  
  6. These routines are compatible with nShell I/O redirection.
  7.  
  8. NSH_getchar
  9. -----------
  10.  
  11. int  NSH_getchar(void);
  12.  
  13. PARAMETERS
  14.  
  15.     none
  16.  
  17. RETURNS
  18.  
  19.     0        no characters available
  20.     -1        end of input
  21.     others        next character in input queue
  22.  
  23. PROCESS
  24.  
  25. This routine polls the Standard Input queue.  If any characters are available, they are returned to the external command.
  26.  
  27. On the console, a control-D is used to signal end of input.
  28.  
  29. NSH_gets
  30. --------
  31.  
  32. int  NSH_gets(char *s, int max_len);
  33.  
  34. PARAMETERS
  35.  
  36.     char    *s        address of a character buffer to fill
  37.     int    max_len    maximum number of characters
  38.  
  39. RETURNS
  40.  
  41.     0        no characters available
  42.     -1        end of input
  43.     others        length of input string
  44.  
  45. PROCESS
  46.  
  47. This routine polls the Standard Input queue.  If any characters are available, they are returned to the external command.  Characters are transferred to the "s" buffer until it is filled, or until a Return character or End Of Input is encountered.  Return characters are placed in the "s" buffer.  If the "s" buffer is smaller than a line of input, the incoming string will be split among subsequent calls.
  48.  
  49. On the console, a control-D is used to signal end of input.
  50.  
  51. NSH_getStr
  52. ----------
  53.  
  54. int  NSH_getStr(Str255 s);
  55.  
  56. PARAMETERS
  57.  
  58.     Str255    s    address of a Pascal string to fill
  59.  
  60. RETURNS
  61.  
  62.     0        no characters available
  63.     -1        end of input
  64.     others        length of input string
  65.  
  66. PROCESS
  67.  
  68. This routine polls the Standard Input queue.  If any characters are available, they are returned to the external command.  Characters are transferred to the "s" string until it is filled, or until a Return character or End Of Input is encountered.  Return characters are placed in the "s" string.  If a line of input is longer than 255 characters, the incoming string will be split among subsequent calls.
  69.  
  70. On the console, a control-D is used to signal end of input.
  71.  
  72.