Warning: Illegal string offset 'doublequoteopening' in /usr/home/svgames/domains/svgames.pl/public_html/dokuwiki/inc/parser/xhtml.php on line 766
Warning: Illegal string offset 'doublequoteclosing' in /usr/home/svgames/domains/svgames.pl/public_html/dokuwiki/inc/parser/xhtml.php on line 774
Warning: Illegal string offset 'doublequoteopening' in /usr/home/svgames/domains/svgames.pl/public_html/dokuwiki/inc/parser/xhtml.php on line 766
Warning: Illegal string offset 'doublequoteclosing' in /usr/home/svgames/domains/svgames.pl/public_html/dokuwiki/inc/parser/xhtml.php on line 774
Warning: Illegal string offset 'doublequoteopening' in /usr/home/svgames/domains/svgames.pl/public_html/dokuwiki/inc/parser/xhtml.php on line 766
Warning: Illegal string offset 'doublequoteclosing' in /usr/home/svgames/domains/svgames.pl/public_html/dokuwiki/inc/parser/xhtml.php on line 774
awful: function: f-rewrite
Available since rev.36 (v.0.5.0).
Declaration
file :f-rewrite ( string $PATH )
Summary
Opens a file on the disk in rewrite mode and returns a handle allowing to perform subsequent operations on the file. The file should be later closed with a call to :f-close
.
If PATH is not writeable or some other kind of error occurs, the returned filehandle will have its emodee flag set to einvalide. The simplest way to check if a file has been opened successfully is to cast it to bool - any invalid (or closed) handle will cast to FALSE.
Can be seen as a shorthand way of performing a :f-open $PATH sewe
call (actually, in interpreter innards, both do the same).
Example
# :f-rewrite example
:set &file :f-rewrite s'example.txt'
!if :not $file
:writeln s'Unable to write to file!'
:exit
!fi
:write s'gibe text plox: '
:set &text s''
:readln &text
:f-writeln $file $text
:f-close $file
wikipage modified on 2014/0611/1016