Ya why not you can definitely write your own versions. Now a small correction , its the stdio library under the glib which defines this printf() and not the gcc. The archieve file /usr/lib/libc.a contains an object (printf.o) inside its archive which has the exact function definition for the printf() function; which is normally linked statically into your program at the link time (again not by 'gcc' directly but the 'ld' itself).
The prototype of printf() looks like the following:
Its taking one const string and a variable number of arguments.
Use varg_ macros to built incremently your own version of printf() library.
Last edited by Praveen_218; 05-14-2010 at 04:05 AM..
Here is the code I'm using
{
printf("%11d %4.2f\% %4.2f\%\n", $1,$2,$3);
}
I want the output to look something like
1235415234 12.24% 52.46%
Instead it looks something like
319203842 42.27\%4.2f\%
How do I just print a "%" without awk or printf thinking I'm trying to do... (1 Reply)
I use FreeBSD,and use signal,like follows:
signal(SIGHUP,sig_hup);
signal(SIGIO,sig_io);
when I run call following code,it can run,but I find a puzzled question,it should print some information,such as printf("execute main()") will print execute main(),but in fact,printf fuction print... (2 Replies)
Hi,
Does anybody have a good pointer on Linux kernel internals for ARM architecture? I can locate plenty for x86 but since ARM is RISC I think there would be subtle changes. So if somebody has a knowledge of good document on Linux Kernel internals for ARM or even a comparative study of kernel on... (0 Replies)
Hello Gurus,
i am ok with the concepts of c language but i would like to know
more about the internals of c with respect to the compilers
what happens when we say
gcc filename.c
the a.out will get created(what actaully compiler does to the code inaddition to generating object code)
... (5 Replies)
Hi friends,
Hope everyone is doing well. Please have a look at this simple program, you will figure out what I want.
#include <stdio.h>
int main()
{
printf("Enter an integer!\n");
scanf( "%d", 134511890 ); // Valid address on my computer
printf( "%d\n", ???? );
return 0;
}
... (3 Replies)
When we put a breakpoint using gcc then what all things happen internally and how the gdb using break is able to pause the execution of process( instead of killing it ) and later on resume the process execution? (0 Replies)
Hello,
Long-time Unix hacker here - I've worked on four variants of the kernel prior to the introduction of Linux. In my spare time, I've written Linux (Ubuntu) device drivers, kernel modules, cross-compiled, and built the kernel.
I'd like to do Linux internals/device drivers as a day job,... (1 Reply)
Discussion started by: OriginalVersion
1 Replies
LEARN ABOUT OSX
xprintf_comp
XPRINTF_COMP(3) BSD Library Functions Manual XPRINTF_COMP(3)NAME
free_printf_comp, new_printf_comp -- extensible printf compilation
SYNOPSIS
#include <printf.h>
void
free_printf_comp(printf_comp_t pc);
printf_comp_t
new_printf_comp(printf_domain_t restrict domain, locale_t restrict loc, const char * restrict fmt);
DESCRIPTION
To ameliorate some of the slowness caused by the extra overhead in extensible printf (see xprintf(5)), a compile/execute mechanism has been
created. The new_printf_comp() function compiles the given format string, along with a printf domain (see xprintf_domain(3)) and an extended
locale (see xlocale(3)), and returns a printf_comp_t structure. The domain may not be NULL, but the locale can be NULL, which means to use
the current locale, either the per-thread locale if it was set, or else the global locale. Because the printf_comp_t structure records the
domain and locale, care should be taken if either of these are changed.
Once a printf_comp_t structure is created, it can be passed to one of the extensible printf execution variants, described in xprintf_exec(3),
along with the necessary arguments. Creating the printf_comp_t structure needs to be done only once, but it can be passed to extensible
printf execution variants any number of times.
When the printf_comp_t structure is no longer needed, it should be passed to free_printf_comp() to release internal memory.
RETURN VALUES
The new_printf_comp() function returns the new structure, or NULL on error (usually NULL domain or out of memory condition).
SEE ALSO xlocale(3), xprintf_domain(3), xprintf_exec(3), xprintf(5)Darwin Aug 19, 2012 Darwin