I cannot find any reference meaning for %.#s or why fprint would output #s which may be printed as a result of undefined behavior. %.2s is applying two places of precision to string str and so prints Zi bearing in mind that a character is treated like an int.
Comment