Re: as is what?
Re: as is what?
- Subject: Re: as is what?
- From: John Delacour <email@hidden>
- Date: Sun, 24 Aug 2003 14:25:00 +0100
At 12:51 pm +0900 24/8/03, micro-people wrote:
Hi,
things below is my first thing @ AS:
--- 8< ---
set a to 2 ^ 32
set b to 99991231 + 99991231
set fileNum to open for access file "sarigama:as:test" with write permission
try
set fileEnd to get eof fileNum
write (a as text) & return to fileNum starting at (fileEnd + 1)
set fileEnd to get eof fileNum
write (b as text) & return to fileNum starting at (fileEnd + 1)
on error errMsg
close access fileNum
error errMes
end try
close access fileNum
It is not necessary to get eof and so long as the file is open, all
new stuff will be written starting at eof, so that's not necessary
either.
If you use a file specification
set f to "sarigama:as:test" as file specification
it is unecessary to bother with filenum and the use of filenum is
_always_ an unecessary complication with no advantages that I know of.
set f to "sarigama:as:test" as file specification
open for access f with write permission
write <something> to f
write <more> to f
close access f
--- 8< ---
when i didn't place "as text" where it is above
things written in the output file was weird = couldn't read it
things above will spit out
4.294967296E+9
199982462
am i doing things in a right way ?
If you want your reals as text then yes, otherwise no. You can write
all sorts of objects to a file.
If your file contains a real number, then you can read it, but you
need to read is as real. The same goes for a list or a record or
whatever.
set f to ("" as Unicode text) & (path to desktop) & "junk.txt" as
file specification
set a to 2 ^ 32
open for access f with write permission
set eof f to 0
write a to f
close access f
read f as real -- <<<<<<<<<<<<<<
i mean ... i should have set a and b in a different way
@ the first two lines
so that i won't have to use "as text" thing?
BTW
can't i have a expressed without "E+9" rapping ?
or i can't get rid of that
simply because a is too huge?
You can get rid of it by parsing the number as text.
JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
References: | |
| >as is what? (From: micro-people <email@hidden>) |