Login
|
Signup
langref.org
-
ruby
,
csharp
,
clojure
,
fsharp
...
add..
all
cpp
erlang
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");
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"))
fsharp
let stream = new StreamWriter("test.txt", true)
stream.WriteLine("This line appended to file!")
#light
open System
open System.IO
let stream = new StreamWriter("test.txt", true)
stream.WriteLine("This line appended to file!")
stream.Close()
fantom
File(`out.txt`).out(true).writeChars("some text").flush
class SolutionXX
{
Void main()
{
File(`out.txt`).out(true).writeChars("some text").flush
}
}
Submit a new solution for
ruby
,
csharp
,
clojure
,
fsharp
...
There are 12 other solutions in
additional
languages (
cpp
,
erlang
,
groovy
,
haskell
...)