L2Hex()

Post Reply
User avatar
toya
Posts: 34
Joined: Sat Dec 31, 2005 10:08 am
Location: Brasil
Contact:

L2Hex()

Post by toya »

Antonio,

Testando L2Hex() contida em ..\source\function\or.c, utilizando o exemplo abaixo estou obtendo um valor diferente.

Code: Select all

#include "fivewin.ch"

function Main()

local nHd:=359532552, xHd:=''

//nHd:=nSerialHD()
xHd:=L2Hex( nHd  )

msginfo( xHd )

return nil

Valor apresentado: 156E080 (hexadecimal)
O valor correto de xHd é: 156E0808 (hexadecimal)
toya
Ahora en la version 6.6
Consultoria e Desenvolvimento - NF-e/NFC-e
http://www.toyanet.com.br
https://www.facebook.com/profile.php?id=100009195956044
toyasis@gmail.com
FWH 10.8+PellesC+xHarbour.org 1.2.1
User avatar
Sebastián Almirón
Posts: 125
Joined: Mon Dec 12, 2005 9:56 am
Location: Moralzarzal - Spain

Post by Sebastián Almirón »

Debe ser un error de OR.C, si no lo solucionas de otro modo, prueba a crear tu propia funcion L2hex(), así:

function l2hex(nvar)
return i2Hex( nhiword(nvar) )+ i2hex(nloword(nvar))

Saludos
User avatar
Sebastián Almirón
Posts: 125
Joined: Mon Dec 12, 2005 9:56 am
Location: Moralzarzal - Spain

Post by Sebastián Almirón »

Bueno, o así para que no devuelva ceros delante:

function l2hex(nvar)
local cRet := i2Hex( nhiword(nvar) )+ i2hex(nloword(nvar))
do while substr(cRet,1,1) = '0'
cRet := substr(cRet,2)
enddo
return cRet
User avatar
toya
Posts: 34
Joined: Sat Dec 31, 2005 10:08 am
Location: Brasil
Contact:

Post by toya »

ok Sebastian...
Já elaborei a minha função, apenas achei estranho a OR.C estar devolvendo um valor incorreto....
toya
Ahora en la version 6.6
Consultoria e Desenvolvimento - NF-e/NFC-e
http://www.toyanet.com.br
https://www.facebook.com/profile.php?id=100009195956044
toyasis@gmail.com
FWH 10.8+PellesC+xHarbour.org 1.2.1
Post Reply