View source code
Display the source code in std/stdio.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla 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
local clone.
Module std.stdio
Category | Symbols |
---|---|
File handles | _popen
File
isFileHandle
openNetwork
stderr
stdin
stdout
|
Reading | chunks
lines
readf
readln
|
Writing | toFile
write
writef
writefln
writeln
|
Misc | KeepTerminator
LockType
StdioException
|
Standard I/O functions that extend core.stdc.stdio. core.stdc.stdio is publically imported when importing std.stdio.
Functions
Name | Description |
---|---|
_popen(name, mode)
|
Convenience function that forwards to core
with appropriately-constructed C-style strings.
|
chunks(f, size)
|
Iterates through a file a chunk at a time by using foreach .
|
openNetwork(host, port)
|
Experimental network access via the File interface |
readf(args)
|
Reads formatted data from stdin using std .
|
readln(terminator)
|
Read line from stdin .
|
readln(buf, terminator)
|
Read line from stdin and write it to buf[], including terminating character.
|
toFile(data, fileName)
|
Writes an array or range to a file.
Shorthand for data .
Similar to write , strings are written as-is,
rather than encoded according to the File 's orientation.
|
write(args)
|
Writes its arguments in text format to standard output (without a trailing newline). |
writef(args)
|
Writes formatted data to standard output (without a trailing newline). |
writefln(args)
|
Equivalent to writef(fmt, args, '\n') .
|
writeln(args)
|
Equivalent to write(args, '\n') . Calling writeln without
arguments is valid and just prints a newline to the standard
output.
|
Classes
Name | Description |
---|---|
StdioException
|
Thrown if I/O errors happen. |
Structs
Name | Description |
---|---|
File
|
Encapsulates a FILE* . Generally D does not attempt to provide
thin wrappers over equivalent functions in the C standard library, but
manipulating FILE* values directly is unsafe and error-prone in
many ways. The File type ensures safe manipulation, automatic
file closing, and a lot of convenience.
|
lines
|
Iterates through the lines of a file by using foreach .
|
Enums
Name | Description |
---|---|
LockType
|
Used to specify the lock type for File and File .
|
Manifest constants
Name | Type | Description |
---|---|---|
isFileHandle
|
Indicates whether T is a file handle, i.e. the type
is implicitly convertable to File or a pointer to a
FILE .
|
Aliases
Name | Type | Description |
---|---|---|
KeepTerminator
|
Flag!("keepTerminator")
|
If flag KeepTerminator is set to KeepTerminator , then the delimiter
is included in the strings returned.
|
stderr
|
makeGlobal!(StdFileHandle.stderr)
|
The standard error stream. |
stdin
|
makeGlobal!(StdFileHandle.stdin)
|
The standard input stream. |
stdout
|
makeGlobal!(StdFileHandle.stdout)
|
The standard output stream. |
Authors
Walter Bright, Andrei Alexandrescu, Alex Rønne Petersen
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.