truncation probably due to typecast in C

In my program I have taken one parameter in argument which I am passing to a function. before passing to it, I set a printf to check whether the argument is taken or not. it was printed properly. but when the function took it, only 3 character was taken and other chars were truncated.
ie. if I give argument “abcdef” only “abc” were taken but “def” was truncated

on argument.h file : (argument variables declared here)

unsigned char ep[32];

on main.c file :

    else if (!(strcmp("-E",argv[i])))
        if (i++==argc) stop_pgm("Argument missed for option -En");
        memset(ep, '', 32);
        //memcpy(ep,argv[i],strlen((const char*)argv[i])+1);

and on function.c file :

int func(void) {

/*other functions ....*/
printf("===== > EP print Flag ###### : %s", ep);
INIT_REGISTER_NSDL_ENDPOINT(endpoint_ptr, (uint8_t *) ep, ep_type, lifetime_ptr);

if I do not parameterize ep and not taking from argument
on function.c,

static uint8_t ep[] = {"emulation"};

It runs well. Is that due to typecasting or something else?

Source: c#

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.