LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

gets

gets

char *gets (char lineBuffer[]);

Purpose

Reads characters from standard input into a buffer until end-of-file is encountered or a newline character is read. If successful, the function returns a pointer to the completed string.

Parameters

Output
Name Type Description
lineBuffer char [] Contains the address of the buffer into which the function reads characters from the standard input. When a newline character is read, it is immediately discarded because it signals the end of the input. An ASCII NUL byte is written to the end of the contents of the buffer.
Note Note  If the function encounters end-of-file and no characters have been read, the contents of this buffer remain unchanged. If a read error occurs during the operation, the contents of this buffer are indeterminate.

Return Value

Name Type Description
returnedLineBuffer char * Contains the result of the function. If successful, the function returns a pointer to the NUL-terminated string of characters read. If end-of-file is encountered and no characters have been read into lineBuffer, the function returns a NULL pointer. If a read error occurs during the operation, gets returns NULL and sets errno to a nonzero value.

Additional Information

Library: ANSI C Library

Include file: ansi_c.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Was this information helpful?