Re: [go-nuts] Failure in file seek

2024-04-08 Thread Nikhilesh Susarla
Thank you. I completely got both the programs wrong by interchanging the parameters. Thank you for pointing it out. On Tuesday 9 April 2024 at 03:27:00 UTC+5:30 Bakul Shah wrote: > > offset, err := f.Seek(0, 10) > > The second argument needs to be one of io.{SeekStart,SeekCurrent,SeekEn

Re: [go-nuts] Failure in file seek

2024-04-08 Thread 'Bakul Shah' via golang-nuts
> offset, err := f.Seek(0, 10) The second argument needs to be one of io.{SeekStart,SeekCurrent,SeekEnd} (0, 1 or 2). go doc os.File.Seek > On Apr 8, 2024, at 2:24 PM, Nikhilesh Susarla wrote: > > github/file-seek/main.go >

Re: [go-nuts] Failure in file seek

2024-04-08 Thread Nikhilesh Susarla
github/file-seek/main.go I did write with ReadOnly also and it failed. Sorry, I assumed both Append and ReadOnly fails. On Tuesday 9 April 2024 at 02:14:48 UTC+5:30 Ian Lance Taylor wrote: > On Mon, Apr 8, 2024, 3:33 PM

Re: [go-nuts] Failure in file seek

2024-04-08 Thread Ian Lance Taylor
On Mon, Apr 8, 2024, 3:33 PM Nikhilesh Susarla wrote: > I wanted to seek around a file by opening it using read-only, but then I > get this error called "Invalid argument" > > https://go-review.googlesource.com/c/go/+/14881 > > I read the above link and they say it is not supported to seek around

Re: [go-nuts] Failure in file seek

2024-04-08 Thread Kurtis Rader
The issue you linked to involves files opened for writing with the O_APPEND flag. That isn't relevant if you opened the file read-only. Please show us the code you wrote. On Mon, Apr 8, 2024 at 1:33 PM Nikhilesh Susarla wrote: > I wanted to seek around a file by opening it using read-only, but t

[go-nuts] Failure in file seek

2024-04-08 Thread Nikhilesh Susarla
I wanted to seek around a file by opening it using read-only, but then I get this error called "Invalid argument" https://go-review.googlesource.com/c/go/+/14881 I read the above link and they say it is not supported to seek around. I tried direct lseek in c language and it failed with same.