binary - Trying to write to a Hex file(.bin) using PB12.5 using BlobEdit (Blob) -
i'm trying write hex file using pb12.5, i'm able write without issues through testing noticed need send null value (00) file @ points.
i know if assign null string, null out entire string tried using blob can insert null value when needed (blobedit(blb_data, ll_pos, chara(0)) )
but blobedit() automatically inserts null value in between each position, don't want it's causing issues i'm trying update hex file. need add chara(lb_byte) each consecutive position in blob.
is there way around or pb unable this? below code:
ll_test = 1 ll_pos = 1 ll_length = len(ls_output) while ll_pos <= (ll_length) ls_data = mid(ls_output, ll_pos, 2) lb_byte = event ue_get_decimal_value_of_hex(ls_data) ll_test = blobedit(blb_data, ll_test, chara(lb_byte), encodingansi!) ll_pos = ll_pos + 2 loop
hex file appears follows:
16 35 2d d8 08 45 29 18 35 27 76 25 30 55 66 85 44 66 57 a4 67 99
after blob update:
16 00 48 00 5d 00 c3 92 00 08 00 48 00 51 00 e2
i hope you:
////////////////////////////////////////////////////////////////////////// // function: f_longtohex // description: long hexadecimal // ambito: public // argumentos: as_number //variable long convert hexadecimal // as_digitos //number of digits return // return: string // example: // f_longtohex(198 , 2) --> 'c6' // f_longtohex(198 , 4) --> '00c6' ////////////////////////////////////////////////////////////////////////// long ll_temp0, ll_temp1 char lc_ret if isnull(as_digitos) as_digitos = 2 if as_digitos > 0 ll_temp0 = abs(as_number / (16 ^ (as_digitos - 1))) ll_temp1 = ll_temp0 * (16 ^ (as_digitos - 1)) if ll_temp0 > 9 lc_ret = char(ll_temp0 + 55) else lc_ret = char(ll_temp0 + 48) end if return lc_ret + f_longtohex(as_number - ll_temp1 , as_digitos - 1) end if return ''
Comments
Post a Comment