getc Kernel Service
Purpose
Retrieves a character from a character list.
Syntax
#include <sys/types.h>
#include <sys/errno.h>
#include <cblock.h>
int getc ( header)
struct clist *header;
struct clist *header;
Parameter
Item | Description |
---|---|
header | Specifies the address of the clist structure that describes the character list. |
Description
Attention: The caller of the getc service must ensure that the character list is pinned. This includes the clist header and all the cblock character buffers. Otherwise, the system may crash.
The getc kernel service returns the character at the front of the character list. After returning the last character in the buffer, the getc service frees that buffer.
Execution Environment
The getc kernel service can be called from either the process or interrupt environment.
Return Values
Item | Description |
---|---|
-1 | Indicates that the character list is empty. |