G

Top  Previous  Next

getc

#include <stdio.h>

int getc (

   FILE *stream

);

server

getc returns the next character from the named input stream. Successive calls on getc return successive characters from the stream. getc is implemented as a macro.

 

EOF is returned on end of file or when a read error is detected.

getchar

#include <stdio.h>

int getchar (void);

server

getchar() is identical to getc(stdin). It returns the next character from the standard input stream stdin.

 

getchar is implemented as a macro.

 

EOF is returned on end of file or read error conditions.

getenv

#include <stdlib.h>

char *getenv (

   const char *name

);

server

This function asks the host operating system to return the value of the string that is pointed to by name. If name is known to the host operating system, the function returns a pointer to the corresponding global string value; otherwise, a null pointer is returned.

 

Note that the string value pointed to by getenv is valid only until the next call on getenv.

 

Subsequent calls on getenv overwrite the memory used for the original result. If you need to make several calls to getenv, you should therefore copy the value returned by getenv into a local string before making further calls.

 

Under MS-DOS, name is assumed to be a pointer to a string which is the name of an environment variable, such as PATH, or any of those defined by the SET command.

 

Note that the names of all environment variables are forced to be upper-case by the command processor. Thus, the result of the following command would be the definition of a variable called FRED set to the value Mixed:

 

» set fred=Mixed

gets

#include <stdio.h>

char *gets (

   char *str

);

server

gets reads a string into str from the standard input stream stdin. The input string is terminated by a newline character, which is replaced in str by a NUL character. gets returns its argument as result.

 

gets returns NULL on end of file or error.

 

Note that gets works differently from the similarly named fgets in its treatment of the terminating newline character: gets deletes the newline, fgets keeps it.