Re: Passing binary data to dll
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Passing binary data to dll
- From: "Robert G. Jakabosky" <bobby@...>
- Date: 2012年8月14日 22:13:44 -0700
On Tuesday 14, Digital wrote:
> Well the "data" var lets say is simply a picture or file alike from
> io.open("file.dat","rb"); etc ...
io.open() returns a file "object" not the contents of the file. The file
object is a userdata value that hold a "FILE *" pointer.
-- open binary file
local file = io.open("file.dat", "rb")
-- read file contents
local data = file:read("*a") -- '*a' means read the whole file.
file:close()
-- pass binary data to 'testfunc'
local somevar = require "modulename"
somevar.testfunc(data)
--
Robert G. Jakabosky