Re: How to write a text line as binary/Hex with a filename by means of Vim command line(s)?

2012-07-06 Thread Salman Halim
On Wed, Jul 4, 2012 at 3:19 AM, John Beckett johnb.beck...@gmail.com wrote: Write a binary file (no newline at end) of characters translated from pairs of hex ASCII characters (no spaces) on current line. function! WriteChars(outfile, text) let chars = '' for i in range(0,

Re: How to write a text line as binary/Hex with a filename by means of Vim command line(s)?

2012-07-04 Thread Chris Jones
On Wed, Jul 04, 2012 at 12:18:48AM EDT, William Fugh wrote: -Vim 7.3 + Vista(SP2) If there are 8 chars in one line like this: 52494646 Question: using Vim command line(s), how to write a binary file, and make it 'RIFF' (4 char, not '52494646') in a viewer of TXT? Just to illustrate: let l1

RE: How to write a text line as binary/Hex with a filename by means of Vim command line(s)?

2012-07-04 Thread John Beckett
William Fugh wrote: If there are 8 chars in one line like this: 52494646 Question: using Vim command line(s), how to write a binary file, and make it 'RIFF' (4 char, not '52494646') in a viewer of TXT? Write a binary file (no newline at end) of characters translated from pairs of hex ASCII

Re: How to write a text line as binary/Hex with a filename by means of Vim command line(s)?

2012-07-04 Thread William Fugh
[...] 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

How to write a text line as binary/Hex with a filename by means of Vim command line(s)?

2012-07-03 Thread William Fugh
Hi guys, -Vim 7.3 + Vista(SP2) If there are 8 chars in one line like this: 52494646 Question: using Vim command line(s), how to write a binary file, and make it 'RIFF' (4 char, not '52494646') in a viewer of TXT? BRs, -- William -- You received this message from the vim_use