Printing an array on file without quotes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Printing an array on file without quotes

Torsten Bergmann
Just use #nextPutAll:

------------------------------------------------------------------
myArray := #(1 2 3 4).
FileStream forceNewFileNamed: 'foo.txt' do: [ :stream |
  stream nextPutAll: myArray asCommaString withoutQuoting ]
------------------------------------------------------------------

If you want to print a single character use #nextPut:

Note that Transcript is also a stream, so it often helps
to write to Transcript first and later switch to the file(stream)
to check writing results.

Have fun
Torsten

--
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail