std.stdio
Standard I/O functions that extend
std.c.stdio
.
std.c.stdio
is automatically imported when importing
std.stdio
.
Public imports
std.c.stdio
Aliases
FGETC
:
FGETWC
:
FLOCK
:
FPUTC
:
FPUTWC
:
FUNLOCK
:
Functions
int
__fp_lock
(
_iobuf
*
)
void
__fp_unlock
(
_iobuf
*
)
int
_fgetc_nlock
(
_iobuf
*
)
int
_fgetwc_nlock
(
_iobuf
*
)
int
_fputc_nlock
(
int
,
_iobuf
*
)
int
_fputwc_nlock
(
int
,
_iobuf
*
)
void
fwritef
(
_iobuf
*
fp
, ...)
Same as
writef
, but output is sent to the stream fp instead of
stdout
.
void
fwritefln
(
_iobuf
*
fp
, ...)
Same as
writefln
, but output is sent to the stream fp instead of
stdout
.
char
[]
readln
(
_iobuf
*
fp
)
Read line from stream fp.
Returns:
null for end of file, char[] for line read from fp, including terminating '\n'
Parameters:
fp
input stream
Throws:
StdioException
on error
Example:
Reads
stdin
and writes it to
stdout
.
import
std
.
stdio
;
int
main
(
)
{
char
[
]
buf
;
while
(
(
buf
=
readln
(
)
)
!=
null
)
writef
(
"%s"
,
buf
)
;
return
0
;
}
void
writef
(...)
Arguments are formatted per the
format strings
and written to
stdout
.
void
writefln
(...)
Same as
writef
, but a newline is appended to the output.
Classes
StdioException
:
Exception
Thrown if I/O errors happen.
Super hierarchy:
Object
->
Exception
->
StdioException
Fields
errno
:
uint
Constructors
this
(
char
[]
msg
)
Inherited methods
from
Object
:
factory
,
notifyRegister
,
notifyUnRegister
,
opCmp
,
opEquals
,
print
,
toHash
,
toString
from
Exception
:
print
,
toString