Re: get and print
posted by: bkb at cnw.com
george wrote:
> The doc says I can write out a group of sequences with print and
> read them in with get. It says after each print to put some white
> space chars after with puts. I'm assuming this is the way that is
> done.
>
> sequence a,b,c
> a = "this is test1"
> b = "this is test2"
> c = "this is test3"
>
> print(fn, a)
> puts(fn," ")
>
> print(fn, b)
> puts(fn," ")
>
> print(fn, c)
> puts(fn," ")
>
> Is this correct??
>
> george
george,
Since you are writing to your file using print, your sequences will be printed
with sequence delimiters {} so there is no need for white space to delimit the
output. For your example you could do two things:
include get.e
sequence a,b,c
a = "this is test 1"
b = "this is test 2"
c = "this is test 3"
atom fn
fn = open( "test.txt", "wb" )
print(fn, a)
print(fn, b)
print(fn, c)
close(fn)
fn = open( "test.txt", "r" )
? get(fn)
? get(fn)
? get(fn)
close(fn)
Alternatively, you could do this (print sequence of sequences and get them all
at once):
include get.e
sequence a,b,c
a = "this is test 1"
b = "this is test 2"
c = "this is test 3"
atom fn
fn = open( "test.txt", "wb" )
print(fn, {a,b,c})
close(fn)
fn = open( "test.txt", "r" )
? get(fn)
close(fn)
It's usually easiest to just experiment to get what you really want...
-- Brian
|
Not Categorized, Please Help
|
|