Login
|
Signup
langref.org
-
ruby
,
csharp
,
fantom
, and
clojure
add..
all
cpp
erlang
fsharp
go
groovy
haskell
java
ocaml
perl
php
python
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Files
Writing
Append to a file
ruby
file = File.new('/tmp/test.txt', 'a+') ; file.puts 'This line appended to file!!' ; file.close()
file = File.new('/tmp/test.txt', 'a+') ; file.puts 'This line appended to file!!' ; file.close()
csharp
.Net 2.0 or later
System.IO.File.AppendAllText("filename.txt", "Some text to append to the file");
System.IO.File.AppendAllText("filename.txt", "Some text to append to the file");
fantom
File(`out.txt`).out(true).writeChars("some text").flush
class SolutionXX
{
Void main()
{
File(`out.txt`).out(true).writeChars("some text").flush
}
}
clojure
(with-out-append-writer "output.txt" (println "This is appended to the file"))
(use '[clojure.contrib.duck-streams :only (with-out-append-writer)])
(with-out-append-writer "output.txt" (println "This is appended to the file"))
Submit a new solution for
ruby
,
csharp
,
fantom
, or
clojure
There are 13 other solutions in
additional
languages (
cpp
,
erlang
,
fsharp
,
groovy
...)