What’s the meaning of the %m formatting specifier?

m conversion specifier is not C but is a GNU extension to printf: From GNU documentation: http://www.gnu.org/software/libc/manual/html_node/Other-Output-Conversions.html The ‘%m’ conversion prints the string corresponding to the error code in errno. See Error Messages. Thus: fprintf (stderr, “can’t open `%s’: %m\n”, filename); is equivalent to: fprintf (stderr, “can’t open `%s’: %s\n”, filename, strerror (errno)); The ‘%m’ … Read more

How to create a file in Ruby

Use: File.open(“out.txt”, [your-option-string]) {|f| f.write(“write your stuff here”) } where your options are: r – Read only. The file must exist. w – Create an empty file for writing. a – Append to a file.The file is created if it does not exist. r+ – Open a file for update both reading and writing. The … Read more

How to know what the ‘errno’ means?

You can use strerror() to get a human-readable string for the error number. This is the same string printed by perror() but it’s useful if you’re formatting the error message for something other than standard error output. For example: #include <errno.h> #include <string.h> /* … */ if(read(fd, buf, 1)==-1) { printf(“Oh dear, something went wrong … Read more

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