You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Use the playground (http://play.golang.org) to post code examples. That way you can easily tell if you have written valid code (which you haven't).
Here is an example, that I think is what you want, which works in the playground (no need to download + build): http://play.golang.org/p/ZkGlmmswpr
Notes:
The os package doesn't have Seek, or WriteAt functions. The os.File type has methods with those names.
You have to use os.OpenFile if you want to modify an existing file, as os.Open only reads a file, and os.Create only creates a new file
Always check errors
WriteAt will *OVERWRITE* the contents from the given offset, so your expected result "12A345" is incorrect. It is not possible to insert characters in the middle of the file with the WriteAt or Write methods.
no1o...@gmail.com
unread,
Mar 10, 2014, 8:58:13 PM3/10/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Thanks for the hlep DV and Carlos. i think i found the reason. i opened the file with "os.O_RDWR|os.O_CREATE|os.O_APPEND)", so every time the cursor is set to the end of the file.