>         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 <nikhilesh1...@gmail.com> wrote:
> 
> github/file-seek/main.go 
> <https://github.com/susarlanikhilesh/file-seek-failure/blob/main/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 Nikhilesh Susarla <nikhil...@gmail.com <>> 
>> 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. I 
>>> tried direct lseek in c language and it failed with same. 
>>> 
>>> Is there any way ?
>> 
>> 
>> What that link says is that if you open the file with O_APPEND then you 
>> can't Seek.  Are you opening with O_APPEND?
>> 
>> If not you will need to provide more information, such as a small program 
>> that demonstrates the problem.
>> 
>> Ian
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com 
> <mailto:golang-nuts+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/536e18e8-4dd3-44a4-8893-d5fa22836996n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/golang-nuts/536e18e8-4dd3-44a4-8893-d5fa22836996n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BB230EEB-9928-4EA3-918F-BAA598137519%40iitbombay.org.

Reply via email to