[Gambas-user] Memory Stream Help

Jussi Lahtinen jussi.lahtinen at ...626...
Sun Nov 20 15:17:08 CET 2011


I don't have any simple runnable example right now, so I hope this helps:

Dim pPointer As Pointer
Dim hStream As Stream
Dim iYourData As Integer
Dim ii As Integer
Dim iNumberOfDataPoints As Integer = x
Dim itmp As Integer

pPointer = Alloc(SizeOf(gb.Integer), iNumberOfDataPoints)

ExternalFunction(pPointer) ''Function takes pointer for output as parameter.

hStream = Memory pPolku For Read

For ii = 1 To iNumberOfDataPoints
itmp = Read #hStream As Integer
iYourData.Add(itmp)
Next

Close #hStream


Jussi



On Sun, Nov 20, 2011 at 06:42, Randall Morgan <rmorgan62 at ...626...> wrote:

> Hi All,
>
> Can someone give me a sample of using memory streams to read and write data
> to/from memory.
>
> I am needing to read data from a C structure allocated by the external
> library (tidy) with the pointer returned to Gambas.
>
> I read the page on external libraries many times before learning the Gambas
> 3 does not allow the use of READ on pointers any longer.
> This should be updated on the how to use external libraries page in the
> section "More on Pointers"
>
> Still, with the given documentation for Gambas3 I am unable to get my
> program to compile. So a sample of reading from memory using a pointer
> would be very helpful.
>
> Thanks!
>
> --
> If you ask me if it can be done. The answer is YES, it can always be done.
> The correct questions however are... What will it cost, and how long will
> it take?
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure
> contains a definitive record of customers, application performance,
> security threats, fraudulent activity, and more. Splunk takes this
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
> _______________________________________________
> 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