Hello everyone,
I am trying to use sprintf, but keep getting error: invalid use of void expression
The function get_l looks like:Code:sprintf(s,"%s",get_l());If I just call the function in the main it works fine. Thanks in advance.Code:void get_l() { FILE *data; char buff[1024]; data = popen("/usr/bin/whoami", "r"); while(fread(buff, 1, sizeof(buff), data) > 0) { printf("%s",buff); } pclose(data); }
Brad