Subject | Re: [firebird-support] UDF to provide Hexadecimal string |
---|---|
Author | Jason Dodson |
Post date | 2005-08-03T16:42:34Z |
Or C/C++:
char *IntToHex(long DecNumber)
{
char *HexNumber[10] = NULL;
// 2^32 == 100000000 in hex
HexNumber = malloc(10); //For C people
HexNumber = new char[10]; //For C++ people
sprintf(HexNumber, "0x%x", DecNumber);
return &HexNumber[0];
}
Or Visual Basic (You have to have the appropriate packages to build
non-ActiveX DLLs):
Public Function IntToHex(ByVal DecNumber as long) as String
IntToHex = Hex$(DecNumber);
End Function
Jason
Ricardo Uzcategui wrote:
char *IntToHex(long DecNumber)
{
char *HexNumber[10] = NULL;
// 2^32 == 100000000 in hex
HexNumber = malloc(10); //For C people
HexNumber = new char[10]; //For C++ people
sprintf(HexNumber, "0x%x", DecNumber);
return &HexNumber[0];
}
Or Visual Basic (You have to have the appropriate packages to build
non-ActiveX DLLs):
Public Function IntToHex(ByVal DecNumber as long) as String
IntToHex = Hex$(DecNumber);
End Function
Jason
Ricardo Uzcategui wrote:
> it's easy. in delphi, you can make a udf with a function with this body:
>
> interface
>
> function IntToHex( var nNumber: integer ): pchar; cdecl; export;
>
>
>
> implementation
>
> function IntToHex( var nNumber: integer ): pchar;
> begin
> result := format('%1.2x',[nNumber])
> end;
>
>
> ----------- end --------------
> remember, this is only the function. you should place in your udf proyect
> (delphi).
>
> ----- Original Message -----
> From: "Steve Harp" <steve@...>
> To: <firebird-support@yahoogroups.com>
> Sent: Wednesday, August 03, 2005 11:58 AM
> Subject: [firebird-support] UDF to provide Hexadecimal string
>
>
>
>>Hi All,
>>
>>Can someone point me to a UDF that will accept an integer and return a
>>hexadecimal representation as a VarChar?
>>
>>Thanks,
>>Steve
>>
>>
>>
>>
>>
>>
>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>
>>Visit http://firebird.sourceforge.net and click the Resources item
>>on the main (top) menu. Try Knowledgebase and FAQ links !
>>
>>Also search the knowledgebases at http://www.ibphoenix.com
>>
>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>