How can I print to standard error in C with ‘printf’?

The syntax is almost the same as printf. With printf you give the string format and its contents ie:

printf("my %s has %d chars\n", "string format", 30);

With fprintf it is the same, except now you are also specifying the place to print to:

FILE *myFile;
...
fprintf(myFile, "my %s has %d chars\n", "string format", 30);

Or in your case:

fprintf(stderr, "my %s has %d chars\n", "string format", 30);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)