On Tue, 16 Mar 2010, [email protected] wrote: > Hi, > > I am using vim7.2 to edit and save a binary mbr file. It contains 512 > bytes. However, inside vim, it shows one additional byte at address > 513. After editing, the saved file is one byte more. So it becomes > invalid mbr. I have found a winvi and xvi both claim can edit bindary > file. I still want to see whether I can use vim. So can anyone tell me > how to edit and save binary file safely in vim? >
You should, at a minimum, pass the '-b' (for binary) flag when starting vim: vi -b mbrfile You could also edit from within vim with the '++bin' option: :e ++bin mbrfile See more at: :h edit-binary Personally, I frequently use the 'Hexmode' toggle from http://vim.wikia.com/wiki/Improved_hex_editing -- Best, Ben -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
