M Mostez Well-Known Member Licensed User Longtime User Apr 29, 2017 #1 Hello, I need to get length of progmem declared array to use it in loop, kindly indicate how to include C code. thanks B4X: #IF C #include <avr/pgmspace.h> const PROGMEM byte ZPL [] = { 0x10,0x43,0x54,0x7E,0x7E,0x43,0x44,0x2C,0x7E,0x43,0x43,0x5E,0x7E,0x43,0x54,0x7E, 0x5E,0x58,0x41,0x7E,0x54,0x41,0x30,0x30,0x30,0x7E,0x4A,0x53,0x4E,0x5E,0x4C,0x54, . . . . };
Hello, I need to get length of progmem declared array to use it in loop, kindly indicate how to include C code. thanks B4X: #IF C #include <avr/pgmspace.h> const PROGMEM byte ZPL [] = { 0x10,0x43,0x54,0x7E,0x7E,0x43,0x44,0x2C,0x7E,0x43,0x43,0x5E,0x7E,0x43,0x54,0x7E, 0x5E,0x58,0x41,0x7E,0x54,0x41,0x30,0x30,0x30,0x7E,0x4A,0x53,0x4E,0x5E,0x4C,0x54, . . . . };
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2017 #2 No. You will need to store it together with the PROGMEM code. Upvote 0
M Mostez Well-Known Member Licensed User Longtime User Apr 30, 2017 #3 may I ask how to declare array length constant and get it in B4R code. thanks Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2017 #4 You don't need to do anything special. If you are using the code from this post: https://www.b4x.com/android/forum/threads/progmem-save-restore-string.78895/#post-499901 then add Log(sb.Length). Create a global variable in B4R: Private ZPL_Length As UInt = <put the number here> Upvote 0
You don't need to do anything special. If you are using the code from this post: https://www.b4x.com/android/forum/threads/progmem-save-restore-string.78895/#post-499901 then add Log(sb.Length). Create a global variable in B4R: Private ZPL_Length As UInt = <put the number here>