473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

wprintf() conflicts with printf(). glibc bug?

On linux federa 10 beta, calling wprintf() following printf(),
wprintf() seems doing nothing$B!%(BAnd vice versa. Is it a glibc bug?
Nov 10 '08 #1
3 4275
steve yee <yi******@gmail.comwrites:
On linux federa 10 beta, calling wprintf() following printf(),
wprintf() seems doing nothing.And vice versa. Is it a glibc bug?
No. All streams may have an orientation (wide or not) but they all
start with none. The first operation will set it thereby rendering
the "other" family of functions invalid. You can test and/or set it
using the fwide function.

--
Ben.
Nov 10 '08 #2
On Nov 10, 8:24 pm, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
steve yee <yiton...@gmail.comwrites:
On linux federa 10 beta, calling wprintf() following printf(),
wprintf() seems doing nothing$B!%(BAnd vice versa. Is it a glibc bug?

No. All streams may have an orientation (wide or not) but they all
start with none. The first operation will set it thereby rendering
the "other" family of functions invalid. You can test and/or set it
using the fwide function.

--
Ben.
Yes. The fwide() can set an orientation. But it the orientation can
not be changed once set. While on AIX printf() and wprintf() do not
interfere with each other.
Nov 11 '08 #3
steve yee <yi******@gmail.comwrites:
On Nov 10, 8:24 pm, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
>steve yee <yiton...@gmail.comwrites:
On linux federa 10 beta, calling wprintf() following printf(),
wprintf() seems doing nothing.And vice versa. Is it a glibc bug?

No. All streams may have an orientation (wide or not) but they all
start with none. The first operation will set it thereby rendering
the "other" family of functions invalid. You can test and/or set it
using the fwide function.

--
Ben.
Best not to quote sigs.
Yes. The fwide() can set an orientation. But it the orientation can
not be changed once set.
That is true. If an implementation permits such a change, it does so
as an extension and a portable program should avoid relying on it.
While on AIX printf() and wprintf() do not
interfere with each other.
Then that is a perfectly legal extension. Section 7.19.2 paragraph 5
says (in part):

"Byte input/output functions shall not be applied to a wide-oriented
stream and wide character input/output functions shall not be
applied to a byte-oriented stream."

The "shall not" phrase means that doing so results in undefined
behaviour. An implementation can do what it likes in such cases. A
programmer should try to avoid them!

--
Ben.
Nov 11 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: kavuri.rajasekhar | last post by:
hai i am new to this group. can anyone give me the code for pritf function. my question is i need to write my own function for the printf statement.
5
by: dank | last post by:
http://msdn2.microsoft.com/en-us/library/tcxf1dw6.aspx describes the integer format modifiers accepted by Microsoft's printf. ...
0
by: sabya123 | last post by:
I have got a problem using printf and wprintf. Can I use them simultaneously in a single program? My problem is that, If I am using both of them in a program only the first one is being taken....
8
by: Rui Maciel | last post by:
I've just started learning how to use the wchar_t data type as the basis for Unicode strings and unfortunately I'm having quite a bit of problems, both in the C front and the Unicode front. In...
20
by: v4vijayakumar | last post by:
When "printf" function returns "EOF"? Will "printf" ever fail?
6
by: Allin Cottrell | last post by:
Code fragment: #include <stdio.h> int main (void) { double a = 1.0; double b = 0.9999999999999999; printf("%#12.5g\n", a);
44
by: Ioannis Vranos | last post by:
Has anyone actually managed to print non-English text by using wcout or wprintf and the rest of standard, wide character functions?
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
1
by: mars | last post by:
Which file is the "printf" implemention in glibc? The stdio.c is very small. It seems using __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) And __printf_chk using __nldbl___vfprintf_chk, but...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.