{"size": 4780, "ext": "scrbl", "max_stars_repo_path": "doc/rnrs/io/simple.scrbl", "max_stars_repo_name": "david135/sagittarius-scheme", "max_stars_repo_stars_event_min_datetime": "2015-11-07T07:13:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T03:35:14.000Z", "max_issues_repo_path": "doc/rnrs/io/simple.scrbl", "max_issues_repo_name": "david135/sagittarius-scheme", "max_issues_repo_issues_event_min_datetime": "2016-04-28T21:59:59.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T08:42:21.000Z", "max_forks_repo_path": "doc/rnrs/io/simple.scrbl", "max_forks_repo_name": "david135/sagittarius-scheme", "max_forks_repo_forks_event_min_datetime": "2016-12-28T12:41:23.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-26T20:52:02.000Z"}
{"max_stars_count": 39, "max_issues_count": 3, "max_forks_count": 4, "avg_line_length": 43.0630630631, "max_line_length": 80, "alphanum_fraction": 0.7535564854}
@; -*- mode:scribble; coding: utf-8 -*-

@subsubsection[:tag "rnrs.io.simple.6"]{Simple I/O}

This section describes the @code{(rnrs io simple (6))}library, which provides
a somewhat more convenient interface for performing textual I/O on ports.

@define[Library]{@name{(rnrs io simple (6))}}
@desc{This library also exports the same procedures as
@code{(rnrs io posts (6))} library. I do not write the documentation of it, if
you want to import only this library, make sure which procedures are exported.
You can see it on R6RS.
}

@define[Function]{@name{call-with-input-file} @args{filename proc . opt}}
@define[Function]{@name{call-with-output-file} @args{filename proc . opt}}
@desc{[R6RS+] @var{Proc} should accept one argument.

These procedures open the file named by @var{filename} for input or for output, 
with no specified file options, and call @var{proc} with the obtained port as
an argument. If @var{proc} returns, the port is closed automatically and the
values returned by @var{proc} are returned. If @var{proc} does not return, the
port is not closed automatically, unless it is possible to prove that the port
will never again be used for an I/O operation.

NOTE: @var{opt} will be passed to @code{open-input-file} or
@code{open-output-file}.
}

@define[Function]{@name{with-input-from-file} @args{filename thunk . opt}}
@define[Function]{@name{with-output-to-file} @args{filename thunk . opt}}
@desc{[R6RS+] @var{Thunk} must be a procedure and must accept zero arguments.

The file is opened for input or output using empty file options, and @var{thunk}
is called with no arguments. These procedure replace current input/output port
during @var{thunk} is being called. When @var{thunk} returns, the port is closed
automatically. The values returned by thunk are returned.

NOTE: @var{opt} will be passed to @code{open-input-file} or
@code{open-output-file}.
}

@define[Function]{@name{open-input-file}
 @args{filename :key (transcoder (native-transcoder))}}
@define[Function]{@name{open-output-file}
 @args{filename :key (transcoder (native-transcoder))}}
@desc{[R6RS+] Opens @var{filename} for input/output, with empty file options,
and returns the obtained port.

If keyword argument @var{transcoder} is given, it must be an transcoder or
#f and will be used to specify the transcoder to open input/output port. If it
is #f, then returned port will be binary port.
}

@define[Function]{@name{close-input-file} @args{port}}
@define[Function]{@name{close-output-file} @args{port}}
@desc{[R6RS] Closes @var{input-port} or @var{output-port}, respectively.
}

@define[Function]{@name{read-char} @args{:optional textual-input-port}}
@define[Function]{@name{peak-char} @args{:optional textual-input-port}}
@desc{[R6RS] These work the same as @code{get-char} and @code{lookahead-char}.
If @var{textual-input-port} is omitted, it defaults to the value returned by
@code{current-input-port}. 
}

@define[Function]{@name{read} @args{:optional textual-input-port}}
@desc{[R6RS] Reads an external representation from @var{textual-input-port}
and returns the datum it represents. The read procedure operates in the same
way as @var{get-datum}.

If @var{textual-input-port} is omitted, it defaults to the value returned by
@code{current-input-port}. 
}

@define[Function]{@name{write-char} @args{char :optional textual-input-port}}
@desc{[R6RS] Writes an encoding of the character char to the
@var{textual-output-port}, and returns unspecified values.

If @var{textual-output-port} is omitted, it defaults to the value returned by
@code{current-output-port}.
}

@define[Function]{@name{newline} @args{:optional textual-input-port}}
@desc{[R6RS] This is equivalent to using @code{write-char} to write
@code{#\linefeed} to @var{textual-output-port}.

If @var{textual-output-port} is omitted, it defaults to the value returned by
@code{current-output-port}.
}

@define[Function]{@name{display} @args{obj :optional textual-input-port}}
@desc{[R6RS] Writes a representation of @var{obj} to the given 
@var{textual-output-port}. Strings that appear in the written representation
are not enclosed in double quotes, and no characters are escaped within those
strings. Character objects appear in the representation as if written by
@var{write-char} instead of by @var{write}. The display procedure returns
unspecified values.

If @var{textual-output-port} is omitted, it defaults to the value returned by
@code{current-output-port}.
}

@define[Function]{@name{write} @args{obj :optional textual-input-port}}
@desc{[R6RS] Writes the external representation of @var{obj} to
@var{textual-output-port}. The @code{write} procedure operates in the same way
as @code{put-datum}.

If @var{textual-output-port} is omitted, it defaults to the value returned by
@code{current-output-port}.
}