[Gambas-user] Reading hex from a string socket read

Daniel Campos daniel.campos at ...338...
Thu Feb 19 18:31:02 CET 2004


> 
> I know eventually there'll need to be some kind of "pack/unpack" 
> function set for Gambas because you need to go from binary to 
> hex to integer (or array) a lot when dealing with legacy systems 
> and ISO protocols.  I don't think my C's up to that right now, 
> though (maybe I can figure out how it works in perl and copy 
> their code somehow.... ugh)

I could add four new static methods in the "Net" class:

Integer to binary string and vice-versa:

EncodeInteger (Number as Integer,Len as Integer) As Integer
DecodeInteger (Number As String) As Integer


Integer in network order to binary string and vice-versa:

EncodeNetInt (Number as Integer,Len as Integer) As Integer
DecodeNetInt (Number As String) As Integer

Should it help?



> 
> Rob
> 
> 
> 
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list