How to print a variable with perror
c
Solution
Use `fprintf()` instead
fprintf(stderr, "error with something %s", my_var);
perror("");
Otherwise you can build a string, then pass it to perror
char yourstring[100];
snprintf(yourstring, sizeof yourstring, "error with something %s", my_var);
perror(yourstring);
Problem
I would like to print a variable with perror, i.e. I would like to write something like `perror("error with something %s", my_var)` Is it possible and how can I do it?