int puts ( const char * str ); |
<cstdio> |
Write string to stdout
Writes the C string pointed by str to stdout and appends a newline character ('\n').
The function begins copying from the address specified (str) until it reaches the terminating null character ('\0'). This final null-character is not copied to stdout.
It is equivalent to fputs(str,stdout).
Parameters
- str
- C string to be written.
Return Value
On success, a non-negative value is returned.
On error, the function returns
EOF.
Example
/* puts example : hello world! */
#include <stdio.h>
int main ()
{
char string [] = "Hello world!";
puts (string);
}
|
See also
fputs | Write string to stream (function) |
printf | Print formatted data to stdout (function) |
putchar | Write character to stdout (function) |
gets | Get string from stdin (function) |