Hi,
I'm working on a routine to write a MIDI file, which involves a lot of bitwise operations to produce a stream of bytes.
I have a working midi read routine, but I was using a string and ASC() function to do the math.
So I thought I would give the buffer variable type a go. (Never used it yet)
The benefit of the buffer would be to be able to directly add bytes and integers to it as raw data.
So when I read that most string operators apply to buffers too, I though that I could add an integer at the end of the buffer like so:
bufVar is Buffer
ar_Var is array of byte
//loop through ar_Var
bufVar+=ar_Var[j]
Unfortunately this results in 3 binary zero's being added at the end too.
Why is that?
When adding a string this way no binary zero's are added.
I have a workaround like so that works:
n=Length(bufVar)+1
bufVar[n]=ar_Var[j]
This code produces neat raw data without the binary zero's.
So problem solved, but it still puzzles me why the simple add method doesn't work...
Kind regards,
Piet