[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Pack/Unpack Functions
[Thread Prev] | [Thread Next]
- Subject: Re: Pack/Unpack Functions
- From: T Lee Davidson <t.lee.davidson@xxxxxxxxx>
- Date: Mon, 24 Feb 2025 09:07:43 -0500
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On 2/24/25 7:52 AM, Benoît Minisini wrote:
Le 24/02/2025 à 11:23, Justin Percy a écrit :Hi,I am trying to port over some PHP code to Gambas and really need Pack/ Unpack functions https://www.php.net/manual/en/ function.pack.phpAny help would be appreciated, thanks! JustinThese functions are PHP-specific. You must implement them "by hand" in Gambas, using OPEN STRING, WRITE and READ. Regards,
Justin, if you don't need compatibility with PHP-packed binary strings, keep in mind that you can serialize an object such as, for example, a collection.
[code] ' Gambas module file Public Sub Main() Dim cData1, cData2 As Collection Dim hStringStream As Stream Dim sData As String cData1 = ["one": 1, "two": 2, "three": 3] hStringStream = Open String For Write Write #hStringStream, cData1 As Collection sData = Close hStringStream hStringStream = Open String sData For Read cData2 = Read #hStringStream As Collection Close hStringStream For Each sValue As String In cData2 Print cData2.Key, sValue Next End [/code] -- Lee --- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ---- --- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----
Pack/Unpack Functions | Justin Percy <justin@xxxxxxxxxxxxxxx> |
Re: Pack/Unpack Functions | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |