Flush - Maple Help

FileTools

 Flush
 flush output for a buffered file

 Calling Sequence Flush(file, file2, ...)

Parameters

 file1, file2, ... - one or more names or file descriptors of open files to be flushed

Description

 • The Flush(file1, file2, ...) command ensures that output, which has been written to the specified files that are assumed to have been opened either implicitly, by Text[Open] or by Binary[Open], is written to disk.
 • The Flush function does not return anything.
 • When a file is closed, it is automatically flushed.

Examples

 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{Open}\right]\left(\mathrm{testfile}\right):$
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{WriteString}\right]\left(\mathrm{testfile},"This is a test\n"\right)$
 ${15}$ (1)
 > $\mathbf{if}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{kernelopts}\left(\mathrm{platform}\right)="windows"\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{then}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{ssystem}\left("type testfile"\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{else}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{ssystem}\left("cat testfile"\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{if}$
 $\left[{0}{,}{""}\right]$ (2)
 > $\mathrm{FileTools}\left[\mathrm{Flush}\right]\left(\mathrm{testfile}\right)$
 > $\mathbf{if}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{kernelopts}\left(\mathrm{platform}\right)="windows"\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{then}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{ssystem}\left("type testfile"\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{else}\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\phantom{\rule[-0.0ex]{2.0em}{0.0ex}}\mathrm{ssystem}\left("cat testfile"\right)\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathbf{end}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{if}$
 $\left[{0}{,}{"This is a test"}\right]$ (3)
 > $\mathrm{FileTools}\left[\mathrm{Text}\right]\left[\mathrm{Close}\right]\left(\mathrm{testfile}\right)$