A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.cplusplus.com/reference/cstdio/puts/ below:

function

<cstdio>

puts
int puts ( const char * str );

Write string to stdout

Writes the C string pointed by str to the standard output (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 terminating null-character is not copied to the stream.

Notice that puts not only differs from fputs in that it uses stdout as destination, but it also appends a newline character at the end automatically (which fputs does not).



Parameters
str
C string to be printed.

Return Value On success, a non-negative value is returned.
On error, the function returns EOF and sets the error indicator (ferror).

Example
1
2
3
4
5
6
7
8
/* 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)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4