String concatenation and/or ternary operator behaves weirdly wit $fwrite

In reply to dave_59:

Sorry for the late reply.

For $fwrite(file_handle, {i != 0 ? “a” : “b”, “%h”}, number);
I expect it to write a or b, depending on the result of the comparison i!=0 followed by number formatted in hexadecimal.

To be more concrete,

$fwrite(f, {“”,“%h”}, 20);
→ " 9576 20"

$fwrite(f, 0!=0 ? “”:“%h”, 20);
→ " 9576 20"

$fwrite(f, “%h”, 20);
→ 00000014

this is what happens, where I would expect every scenario to produce the last output.

Is there some interaction with the concatenation and ternary op here I do not know?