Greeting.
I am working on an application to build a dataset that represents a memory image (from a satellite dump, but that's not important). Using Excel, I specify the order, size, and calibration of the various fields I want in the dumped data. Then a macro builds the buffer according to the spreadsheet. That's working fine. What I have now outputs an ASCII HEX file representation of the buffer. I would also like to output the actual binary file. The problem is I don't know how to output without linefeeds and it's impractical to put the entire buffer in a single print statement.
Without posting needless code (although I will if anyone thinks it might not be needless), here's what I have:
followed later by:
where wrd is an ASCII hex string, and b2d and h2b are functions I wrote to convert binary to decimal and hex to binary (they seem to be working fine).
I'm getting an abend on the Print statement to the effect of
The whole Chr() seems to be working like I want but just opening for output and printing normally throws in linefeeds all over the place. And obviously, if there's a way to use open and print to do what I want, I don't know what it is. Any suggestions?
_________________
Bob Rashkin
I am working on an application to build a dataset that represents a memory image (from a satellite dump, but that's not important). Using Excel, I specify the order, size, and calibration of the various fields I want in the dumped data. Then a macro builds the buffer according to the spreadsheet. That's working fine. What I have now outputs an ASCII HEX file representation of the buffer. I would also like to output the actual binary file. The problem is I don't know how to output without linefeeds and it's impractical to put the entire buffer in a single print statement.
Without posting needless code (although I will if anyone thinks it might not be needless), here's what I have:
Code:
Open hmdir & "lhb.bin" For Random As #2 Len = 1
Code:
wrdlen = Len(wrd)
For bix = 1 To wrdlen - 1 Step 2
bnum = Mid(wrd, bix, 2)
bnum2 = b2d(h2b(bnum))
Print #2, Chr(bnum2)
Next
I'm getting an abend on the Print statement to the effect of
Run-time error '54'
Bad file mode
The whole Chr() seems to be working like I want but just opening for output and printing normally throws in linefeeds all over the place. And obviously, if there's a way to use open and print to do what I want, I don't know what it is. Any suggestions?
_________________
Bob Rashkin