473,385 Members | 1,813 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,385 software developers and data experts.

format specifier

Q: why the format specifiers are used in c but not in c++. pls rply .

thanks
May 16 '07 #1
3 1220
DeMan
1,806 1GB
Format Specifiers are available in both c and c++ (I assume you mean %c %d %x %e etc)?
V=Could you please clarify the question!
May 16 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
Format Specifiers are available in both c and c++ (I assume you mean %c %d %x %e etc)?
V=Could you please clarify the question!
Actually, these format specifiers are to operate functions in the C libraries. While you can use relic C functions in C++, there is no need. The C format specifiers do not apply to anything other than the fundamental types and are, therefore, useless with your own objects. C++ uses operator overloading instead.
May 16 '07 #3
AdrianH
1,251 Expert 1GB
Actually, these format specifiers are to operate functions in the C libraries. While you can use relic C functions in C++, there is no need. The C format specifiers do not apply to anything other than the fundamental types and are, therefore, useless with your own objects. C++ uses operator overloading instead.
Though it is true that they are relics from C, I still find them useful and eaiser to use on base types. However I do agree that C++ streams and the overload mechinism is cleaner for a lot of other things.


Adrian
May 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: John Lenton | last post by:
Is there any reason python's printf-style formatting is missing the (C99) '%a' specifier? I'm sorry if this has been asked and answered before; I can't find it on google ('%a' is a very awkward...
0
by: Josiah Carlson | last post by:
Good day everyone, I have produced a patch against the latest CVS to add support for two new formatting characters in the struct module. It is currently an RFE, which I include a link to at the...
4
by: Peter Ammon | last post by:
Does anyone ever write the arguments to printf()-like functions under the corresponding format specifier? printf("My name is %s and I am %u years old\n", name, age); If the arguments...
6
by: John L. | last post by:
I've seen several postings asking this, but no simple, clear answer. My C language reference book is deficient in this area. If I short i = 0; printf(">%2x<",i); I might resonably expect...
5
by: siliconwafer | last post by:
Hi All, What does a 'format specifier' do? Suppose I do, int a = 43; //decimal number printf("%x",a); I will get hex equivalent of 43. Does the format specifier do an implicit "decimal to hex"...
4
by: ThisBytes5 | last post by:
I need to turn 40000 in to 40,000 for display. Is there a way to do this directly in the Gridview and I'm just not seeing it? or do I have to use a TemplateField and do my own Formatting? ...
18
by: Money | last post by:
Here in this thread http://groups.google.co.in/group/comp.lang.c/browse_frm/thread/c16d280238a95c9/e3b0dbf76f3e02e3?q=finding+endianness&rnum=1#e3b0dbf76f3e02e3 Tydr Schnubbis in 3rd reply used...
2
by: =?Utf-8?B?Um9ubmllIFNtaXRo?= | last post by:
Hello, I would like to be able to accept a format string in the form of say {0:D2} as an input from a dialog box, and then dynamically format the output string based on this new format...
7
by: codinginc | last post by:
Hi Everyone, Is it possible to insert format specifier in a form of variable. See example below Standard from char result; float fnum = 3.14159; sprintf( result, "%f", fnum );...
15
by: Andreas Eibach | last post by:
.... but I have an unsigned long value in the printf. This warning came when I used gcc 4.x to compile. .... unsigned long offset = 0; .... Well OK, an "easy" way would be instead of printf...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.