The Artima Developer Community
Sponsored Link

Scala Buzz
The simple cat command accross platform

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Zemian Deng

Posts: 49
Nickname: zdeng
Registered: Jan, 2008

Zemian Deng is the creator of SweetScala web framework
The simple cat command accross platform Posted: Sep 28, 2008 4:49 PM
Reply to this message Reply

This post originated from an RSS feed registered with Scala Buzz by Zemian Deng.
Original Post: The simple cat command accross platform
Feed Title: thebugslayer
Feed URL: http://www.jroller.com/thebugslayer/feed/entries/atom?cat=%2FScala+Programming
Feed Description: Notes on Scala and Sweet web framework
Latest Scala Buzz Posts
Latest Scala Buzz Posts by Zemian Deng
Latest Posts From thebugslayer

Advertisement

If you miss the cat command on Windows, then few minutes of Scala scripting can be very joyful.

Here is my simple version of cat command in Scala:


//file: cat.scala
import java.io._

val files = args
for(f <- files){
val reader = new BufferedReader(new FileReader(f))
var ln: String = null
while({ln = reader.readLine; ln != null})
println(ln)
}

TO run it, try: C:> scala cat.scala myfile.txt

Read: The simple cat command accross platform

Topic: Functional Purity in Scala Previous Topic   Next Topic Topic: tomcat6.0.18 has bug on their startup script when using CATALINA_BASE

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use