Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 543 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code for printf function in C

#1
> **Possible Duplicate:**
> [source code of c/c++ functions](

[To see links please register here]

)

<!-- End of automatically inserted text -->

I was wondering where I can find the C code that's used so that when I write printf("Hello World!"); in my C programm to know that it has to print that string to STDOUT. I looked in <stdio.h>, but there I could only find its prototype int printf(const char *format, ...), but not how it looks like internally.
Reply

#2
Here's the GNU version of `printf`... you can see it passing in `stdout` to `vfprintf`:

__printf (const char *format, ...)
{
va_list arg;
int done;

va_start (arg, format);
done = vfprintf (stdout, format, arg);
va_end (arg);

return done;
}

[See here.][1]

Here's [a link][2] to `vfprintf`... all the formatting 'magic' happens here.

The only thing that's truly 'different' about these functions is that they use varargs to get at arguments in a variable length argument list. Other than that, they're just traditional C. (This is in contrast to Pascal's `printf` equivalent, which is implemented with specific support in the compiler... at least it was back in the day.)


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through