Hello.

Thank you for your reply and, please, accept my apologies if my email
alarmed you.

Actually, I may have presented my situation in a not-so-good way.

My main problem was how to read anything at all, since I was not able to
find a class for such sole purpose (something like java.util.Scanner) nor
embed Java code like in version 1.5.

By the way, is there any reference, beside the 'Report on the Experimental
Language' I may check? I, honestly, had no idea x10.io.Console.IN had a
'readLine' method.


Best regards.

João


On Mon, Apr 27, 2009 at 4:24 PM, Igor Peshansky <[email protected]> wrote:

> Joao Luis <[email protected]> wrote on 04/26/2009 08:13:22 AM:
>
> > Hello.
> >
> > I've been working with X10 for a college class and I'm supposed to
> implement
> > a given algorithm. Though, it would be great to be able to read data
> from a
> > file, or even stdin, and output them.
> >
> > I'm quite able to output data using x10.io.Console, but it seems
> impossible
> > to read data from a file or stdin; of course I'm assuming I'm
> completelly
> > wrong, but I don't seem to find any evidence on the contrary.
> >
> > I'm using X10 version 1.7.
>
> Hi, Joao,
>
> How exactly are you reading the input?  I've just tried the following:
>
> public class IOTest {
>  public static def main(Rail[String]) {
>    try {
>      val s = x10.io.Console.IN.readLine();
>      x10.io.Console.OUT.println(s);
>    } catch (x10.io.IOException) { }
>  }
> }
>
> and it worked perfectly.  Another recommended usage (from x10.io.Reader)
> is
>
> try {
>   val input = new File(inputFileName);
>   val output = new File(outputFileName);
>   val i = input.openRead();
>   val p = output.printer();
>   for (line in i.lines()) {
>      line = line.chop();
>      p.println(line);
>   }
> } catch (IOException) { }
>
> What is the problem you're encountering?
>        Igor
> --
> Igor Peshansky  (note the spelling change!)
> IBM T.J. Watson Research Center
> XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/)
> X10: Parallel Productivity and Performance (http://x10.sf.net/)
>
>


-- 
Joao Eduardo Luis
------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to