C++ Standard Library C++ STL Library

C++ <cstdio> - stdout



The C++ <cstdio> stdout is a predefined stream. It is associated with the standard output stream, which is the default destination of output for applications. In most systems, it is usually directed by default to the text console (generally, on the screen). At program startup, the stream is fully buffered if and only if the stream can be determined not to refer to an interactive device.

stdout is expanded to expressions of type FILE*. Therefore, it can be used with any function which expects an output stream (FILE*) as one of its parameters, like fputs() or fprintf().

In the <cstdio> header file, it is defined as follows:

#define stdout /* implementation-defined */

Example:

In the example below, stdout is used with fputs() function to print the content on the screen.

#include <cstdio>
 
int main (){

  //prints str on screen
  char str[50] = "Hello World!";
  fputs(str, stdout);
  
  return 0;
}

The output of the above code will be:

Hello World!

❮ C++ <cstdio> Library