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 (
"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