printf and wprintf in single C code

后端 未结 2 1472
天涯浪人
天涯浪人 2020-12-30 00:26

I have a problem when using printf and wprintf functions together in code. If the regular string is printed first, then wprintf doesn\

2条回答
  •  一个人的身影
    2020-12-30 01:24

    This is to be expected; your code is invoking undefined behavior. Per the C standard, each FILE stream has associated with it an "orientation" (either "byte" or "wide) which is set by the first operation performed on it, and which can be inspected with the fwide function. Calling any function whose orientation conflicts with the orientation of the stream results in undefined behavior.

提交回复
热议问题