06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

pREPC+ <strong>System</strong> <strong>Calls</strong> gets<br />

gets Gets a string from stdin.<br />

#include <br />

#include <br />

char *gets(<br />

char *s /* buffer */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

Notes<br />

See Also<br />

The gets() function reads characters from the standard input device into a user<br />

buffer(s). It continues to read characters until a new-line character is read or an<br />

end-of-file condition is detected. Any new-line character is discarded, and a null<br />

character is added after the last character read into the user buffer.<br />

s Points to the user buffer.<br />

If successful, the gets() function returns s. If a read error occurs or an end-of-file<br />

condition is detected before any characters are read, a null pointer is returned. If an<br />

error occurs, errno is set.<br />

Refer to Appendix B.<br />

Callable From<br />

■ Task<br />

puts, fgets<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 3-71<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!