function! WriteChars(outfile, text)
let chars = ''for i in range(0, len(a:text)-1, 2)let chars .= nr2char('0x'.a:text[i : i+1])
endfor
call writefile([chars], a:outfile, 'b')
endfunction
command! WriteChars call WriteChars('data.bin', getline('.'))
Good one. that's what i need. Thank you so much!
Put above in file writechars.vim.
In Vim, enter:
:so writechars.vim
Put cursor on wanted line and enter (type :Wr and press Tab):
:WriteChars
File data.bin now contains the four characters.
John
--
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
--
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
No comments:
Post a Comment