Hello,

try

(with-open [of (java.io.FileWriter. "/path/to/your/file")]
  (.write of "coucou"))

As far as java libraries are concerned, and answer commonly seen in this ml
is : "use apache commons io". And indeed it does the job well, but, yes,
it's then another dependency to your project, for what one might consider a
very basic feature.

http://commons.apache.org/io/

HTH,

-- 
Laurent



2009/3/24 e <evier...@gmail.com>

> is there something as simple as this in clojure?
>
> whole python program:
>
>     of = open(filename,"w")
>     of.write("hello")
>     of.close()
>
> I checked the api and looked around the wiki and google quickly and saw how
> to use java's stuff to do it ... but, welll...
>
> I noticed "slurp" in the api for reading ... but only the whole file at
> once (read() but no readline()).  Is there something symmetrical for writing
> (outputting)?  Is there a web page called "File IO" somewhere?
>
> Thanks.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to