This will seem to work fine too however is completely incorrect and some day when you least expect it will explode in your face:
printf("%s\n", x.toLocal8Bit().constData());
QString x = "abc";
printf("%s\n", x.toLocal8Bit().constData());
To copy to clipboard, switch view to plain text mode
Sorry, it's no argument for me that something "works".
By the way, this will also "works" most of the time:
int x, y; // uninitialized
int z = x/y;
int x, y; // uninitialized
int z = x/y;
To copy to clipboard, switch view to plain text mode
Bookmarks