Difference between file and URL

Ken Ray kray at sonsothunder.com
Sun Dec 5 13:50:44 EST 2004


On 12/5/04 12:02 PM, "John Rule" <johnrule at rcsprogramming.com> wrote:

> 
> I am discovering that open/write/close to a file can be a problem if the
> original file size is larger than the new data size...it simply overwrites
> data in the file, leaving the extra data in tact. Using 'put into URL' does
> not do this (it overwrites the entire file). Is this correct behavior, or a
> bug?

John,

This is correct behavior because the default form of 'open file' is
'update', which does exactly what you're describing. 'open file' has four
forms in the syntax:

  open file <path> [for [text|binary] {update|read|write|append}]

If you were to use:

  open file <path> for text write

it would overwrite the data in the file as you're expecting (and as "put
into URL" does). See the Transcript Dictionary for more on this.


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list