Jump to content

Write entire file: Difference between revisions

m
No edit summary
Line 96:
puts(fn,img)
close(fn)</lang>
Obviously as that can successfully write a binary executable, simple strings are no problem., Theexcept distributionthat alsowhen includesdealing with text you would normally want automatic line ending conversion enabled, so drop the file'b' builtins\writefile.e(binary) whichmode declaresoption, ie the "wb" above should be just "w".
 
The distribution also includes the file builtins\writefile.e which declares
<lang Phix>global function write_file(object file, sequence data, integer as_text = BINARY_MODE, integer encoding = ANSI, integer with_bom = 1)</lang>
which is intended to be a one-line call with full unicode support, however as yet it is neither properly documented nor adequately tested.
7,820

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.