Standard Input and Output Streams - D Programming Language
Description: D Programming Language
Keywords: D programming language

Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Discord (community-run)
  - Forums
  - IRC
  - Wiki
  - Issues
  - Contributing
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# Standard Input and Output Streams

So far, the printed output of our programs has been appearing on the terminal window (or screen). Although the terminal is often the ultimate target of output, this is not always the case. The objects that can accept output are called standard output streams.

The standard output is character based; everything to be printed is first converted to the corresponding character representation and then sent to the output as characters. For example, the integer value 100 that we've printed in the last chapter is not sent to the output as the value 100, but as the three characters `1`, `0`, and `0`.

Similarly, what we normally perceive as the keyboard is actually the standard input stream of a program and is also character based. The information always comes as characters to be converted to data. For example, the integer value 42 actually comes through the standard input as the characters `4` and `2`.

These conversions happen automatically.

This concept of consecutive characters is called a character stream. As D's standard input and standard output fit this description, they are character streams.

The names of the standard input and output streams in D are `stdin` and `stdout`, respectively.

Operations on these streams normally require the name of the stream, a dot, and the operation; as in `stream.operation()`. Because `stdin`'s reading methods and `stdout`'s writing methods are used very commonly, those operations can be called without the need of the stream name and the dot.

`writeln` that we've been using in the previous chapters is actually short for `stdout.writeln`. Similarly, `write` is short for `stdout.write`. Accordingly, the hello world program can also be written as follows:

    import std.stdio;

    void main() {
        stdout.writeln("Hello, World!");
    }

##### Problem

Observe that `stdout.write` works the same as `write`.

... çözüm

Copyright © 1999-2026 by the D Language Foundation | Page generated by Ddoc on Wed Aug 19 13:28:53 2026