On Wed, Jun 20, 2012 at 11:07 AM, Patrick Masotta <masottaus@xxxxxxxxx>wrote: > I did what you say but I'm getting sz=0, not 50 as expected ... :-( > The C string is there with the correct initial value and all of that.. > I just cannot get its size. > what could be wrong? > It seems to give the correct result for me: E:\CPP\2010\LuaJIT-2.0.0-beta10\bin>luajit.exe LuaJIT 2.0.0-beta10 -- Copyright (C) 2005-2012 Mike Pall. http://luajit.org/ JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc fuse > ffi = require"ffi" > var_01 = ffi.new("char[50]", "initial value for var_01" ) > sz = ffi.sizeof(var_01) > print(sz) 50 If you're not seeing the correct result, then reduce your code to a minimal test case like above, and we'll probably be able to identify the problem.