Re: Help,Help,Help and Hello again

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Fri, 22 Sep 2000, David Mosley wrote:

> Thanks for the help I will study it,The print.e is a good include file I
> don't know if it is for the Linux Version?

Yes, it works in all versions. It's useful for print()ing things to disk files
while maintaining them in human readable (and editable) form. Unlike Euphoria's
built-in print() command, which prints things as numbers:
e.g. a sequence like this: s = {"Hello",1,2,3}
will be printed as {{72,101,108,108,111},1,2,3} by Euphoria's print() function,
and as {"Hello",1,2,3} by PRINT.E.'s print() function.
The second version saves disk space and is certainly more readable.
Either version can be read back in using the standard get() function.

 > as far as the print statement > sometimes it works for me and somtimes it
does not I think I have not > learned how to use it yet. let me ask a ? about
it .if you print to a file > and then read it back and then print(puts) it back
to the sreen will it be > readably? or do you have to do something to it.

You certainly do need to do something first - when reading data back in
with get(), you get not only the original data, but also an error code, like so:
{0,{{72,101,108,108,111},1,2,3}}
That zero at the beginning is the flag meaning "success" in reading the file,
so you check it, and then remove it from your actual data:
object data
data = get(fn)
if data[1] = GET_SUCCESS then
  data = data[2] -- read was good
else
 puts(1,"ERROR IN DATA")
....
> > budget[INCOME] = prompt_number("Income: ",{0,4000})
>  What is the 4000 there? I didn't know you could do that to the
> prompt_number or string you learn something new everyday.

That sets the minimum and maximum acceptable inpuit ~
if you were to try to enter -1, for example, Euphoria will print a message:
"A number between 0 and 4000 is required" and give you a chance to redo the
entry.

Regards,
Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu