Is it common to pass arguments to perror(), or is it usually used for a very generic message. For example, something like:
char buffer[50];
sprintf(buffer, "The file %s could not be opened", filename);
perror(buffer);
The reason I ask is because it seems the single arg to perror must be a string literal (without any format specifiers), and so perhaps it discourages using any variables?
Or, is there a shortform way to do something like:
perror("The file %s could not be opened", filename);
(Perhaps a macro?)