getc
Definition: | integer i = getc(integer fn) |
Description: | Get the next character (byte) from file or device fn. The character will have a value from 0 to 255. -1 is returned at end of file. |
pwa/p2js: | Not supported. I would hope it is pretty obvious that you cannot read a disk file from within a browser, and should you be thinking of keyboard input, that would have to be (say) KEY, or perhaps the older KEY_CB. |
Comments: | File input using getc() is buffered, i.e. getc() does not actually
go out to the disk for each character. Instead, a large block of
characters will be read in at one time and returned to you one
by one from a memory buffer.
When getc() reads from the keyboard, it will not see any characters until the user presses Enter. Note that the user can type control-Z, which the operating system treats as "end of file". -1 will be returned. getc0() is a low-level equivalent of {} = getc(0), aka if getc(0) then end if, see builtins\puts1[h].e (not an autoinclude) |
Implementation: | via :%opGetc in builtins\VM\pfileioN.e (an autoinclude) - be warned however it is low-level complicated stuff that you do not need to know. |
See Also: | gets, get_key, wait_key, open |