On Mon, 12 Aug 2002, Jerome Quelin wrote:
> Thus, I thought this one was the one I wanted. So: > LOAD: > read S0, 256 > chopn S0, 1 # trailing newline > open I10, S0, "r" > eq I10, 0, ERR_IO > set S1, "" # Accumulator > LOAD_READ: > read S1, I10, 256 > print S1 > print "\n" > end > ERR_IO: > print "I/O err\n" > end > > So, what am I doing wrong? What's the real syntax? (I wish there were a > parrotopentut ;) ). Your first line is presumably a typo, since there is no read STR, INT op at the moment; the syntax of the rest looks OK. Unfortunately, the real problem is that the read & write ops don't currently work well in combination with the open & close ops -- see bug #15357 > While I'm at reading files - why isn't there a readline op for file handles? > Is it planned / forbidden for an unknown (to me) reason / other (patches > welcome :o) )? Pass. > Another question. Is there a way to fetch command line arguments, such as: > $ ./parrot foo.pbc foo bar baz Yes: at start-up, they're in an array in register P0. So: set S1, P0[0] print S1 print "\n" end prints the name of the program, set S1, P0[1] print S1 print "\n" end prints the first argument, etc. Simon