Hi,
The problem is the "addr" file is closed between your calls. When you open
the "addr" file next time, an internal address is set to 0,0.
But after the writing the address is actual and if you read "data" file you
will see the text according to your address.

I you write the code on C or Go without a closing a descriptor of "addr"
file, everything will be ok :-)
<------------------------------------------------------------------------------------->
santucco@santucco ~/work/go/src/test $ cat test.go
package main

import (
        "bitbucket.org/santucco/goacme"
        "fmt"
        "io"
)

func main() {
        w, err:=goacme.New()
        if err!=nil {
                panic(err)
        }
        defer w.Close()
        if _, err:=w.Write([]byte("test\ntest2\n")); err!=nil {
                panic(err)
        }
        if err:=w.WriteAddr("#5,#10"); err!=nil {
                panic(err)
        }
        f, err:=w.File("addr")
        if err!=nil {
                panic(err)
        }
        b:=make([]byte,100)
        if _, err:=f.Read(b); err!=nil&&err!=io.EOF {
                panic(err)
        }
        fmt.Println(string(b))
}
santucco@santucco ~/work/go/src/test $ go build
santucco@santucco ~/work/go/src/test $ ./test
          5          10

<------------------------------------------------------------------------------------->
Best regards,
  santucco


On Sat, Aug 31, 2013 at 9:29 PM, James A. Robinson <
j...@highwire.stanford.edu> wrote:

> On Sat, Aug 31, 2013 at 10:23 AM, James A. Robinson <
> j...@highwire.stanford.edu> wrote:
>
>> I see the entire text of the window get selected.
>> I had assumed that if I then read addr that I would
>> get back two numbers, 0 and the final byte offset
>> of the file (it is a non-zero length file).
>>
>> However, I get back two zeros:
>>
>> $ 9p read acme/2/addr
>>           0           0
>>
>> What am I missing?
>>
>
> I should have said character offset, not byte offset.
> I was also experimenting with using addr=dot, but
> didn't see any change in behavior.
>
> Jim
>
>


-- 
Best regards,
  santucco

Reply via email to