Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Changing a data in a file using open+change+close does no t work?

 [1/4] from: micael::gullmes::telenordia::se at: 31-Mar-2002 20:57


Hi all, 'close' does not always behave according to the rebolcore docs: Access to a port is terminated with the close function. All buffered data that has not been saved will be written to the target file. When I change data in a file and close it, the changes are not written to the file. Here is an example that does not work the way I want:
>> write %test1.txt "This is a test" >> a: open/lines %test1.txt >> first a
== "This is a test"
>> change first a "Is this"
== " a test"
>> first a
== "Is this a test"
>> close a >> print read %test1.txt
This is a test Does anyone have any hints? Brgds/Micael

 [2/4] from: greggirwin::mindspring::com at: 31-Mar-2002 15:44

Re: Changing a data in a file using open+change+close does not work?


Hi Micael, << 'close' does not always behave according to the rebolcore docs: Access to a port is terminated with the close function. All buffered data that has not been saved will be written to the target file. ...
>> change first a "Is this"
== " a test" >> I think you need to use the port directly, rather than changing FIRST from the port. I.e. FIRST will return a value it reads from the port, but writing to that value is not the same as writing to the port. --Gregg

 [3/4] from: g:santilli:tiscalinet:it at: 1-Apr-2002 12:26

Re: Changing a data in a file using open+change+close does no t work?


Hi Micael, On Sunday, March 31, 2002, 8:57:33 PM, you wrote: MGts> Does anyone have any hints?
>> help update
USAGE: UPDATE port DESCRIPTION: Updates the data related to a port. UPDATE is a native value. ARGUMENTS: port -- (Type: port) But anyway, that seems to be a bug, so please report it to feedback (if you didn't already). Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

 [4/4] from: g:santilli:tiscalinet:it at: 1-Apr-2002 12:44

Re: Changing a data in a file using open+change+close does not work?


Hi Gregg, On Monday, April 01, 2002, 12:44:01 AM, you wrote: GI> I think you need to use the port directly, rather than changing FIRST from GI> the port. I.e. FIRST will return a value it reads from the port, but writing GI> to that value is not the same as writing to the port. Oops, I missed that in my previous post. Please ignore it. :-) Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r