Hi, I'm trying to convert a void pointer to a struct pointer.. that's seems very easy but my compiler give me error.
Thanks.
/home/subi/Personal/Projects/LinkedListUserInfo/main.cpp||In function ‘error_t parse_opt(int, char*, argp_state*)’:|
/home/subi/Personal/Projects/LinkedListUserInfo/main.cpp|50|error: expected primary-expression before ‘)’ token|
/home/subi/Personal/Projects/LinkedListUserInfo/main.cpp|50|error: expected ‘;’ before ‘null_pointer’|
/home/subi/Personal/Projects/LinkedListUserInfo/main.cpp|48|warning: unused variable ‘null_pointer’|
||=== Build finished: 2 errors, 1 warnings ===|
static error_t parse_opt(int key, char *arg, struct argp_state* state)
{
void* null_pointer = state->input;
[B] struct arguments *arguments;
arguments = (arguments*) null_pointer;[/B]
switch (key)
{
case 'v':
arguments->verbose = 1;
break;
case 'i':
arguments->infile = arg;
break;
case 'o':
arguments->outfile = arg;
break;
case ARGP_KEY_ARG:
if (state->arg_num >= 1)
{
argp_usage(state);
}
arguments->args[state->arg_num] = arg;
break;
case ARGP_KEY_END:
if (state->arg_num < 1)
{
argp_usage(state);
}
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
}