On Tue, Dec 4, 2012 at 6:21 PM, Enlightenment SVN
<[email protected]> wrote:
> Log:
> New embryo function: get_program_id
>
> It is now you can run programs with names generated dinamically. Say that
> you
> have 10 programs indexed somehow. You can now call them using the following
> snippet:
>
> script {
> new program_id[15], i;
> for (i = 0; i < 10; i++) {
> snprintf(program_id, 15, "my_program_%d", i+1);
> run_program(get_program_id(program_id));
> }
> }
>
By the way, I noticed a bug in Embryo's snprintf. I can specify
something like "my_program_%02d" as format string and it will generate
as result "my_program_01", "my_program_02", and so on. It will use '0'
to the left of the number if it is less than 2 chars long. See test
code attached.
--
Eduardo de Barros Lima ◤✠◢
[email protected]
#include <string.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
char buf[30];
int i, max = 20;
for (i = 0; i < max; i++) {
snprintf(buf, sizeof(buf), "custom_part_%05d_state_%02d", i, max-i);
printf("%s\n", buf);
}
return 0;
}
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel