第1个回答 2012-06-19
printf()已经被编译成目标代码了,那是找不到的.但是可以在include目录下stdio.h中找到它的声明:
......
char *_Cdecl gets(char *__s);
void _Cdecl perror(const char *__s);
int _Cdecl printf(const char *__format, ...);
int _Cdecl puts(const char *__s);
int _CType remove(const char *__path);
int _CType rename(const char *__oldname,const char *__newname);
void _Cdecl rewind(FILE *__stream);
int _Cdecl scanf(const char *__format, ...);
.....本回答被网友采纳
第3个回答 2012-09-07
什么找不到,我贴出来给你看:
/***
*printf.c - print formatted
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* defines printf() - print formatted data
*
*******************************************************************************/
#include <cruntime.h>
#include <stdio.h>
#include <dbgint.h>
#include <stdarg.h>
#include <file2.h>
#include <internal.h>
#include <mtdll.h>
#include <stddef.h>
#include <process.h>
/***
*int printf(format, ...) - print formatted data
*
*Purpose:
* Prints formatted data on stdout using the format string to
* format data and getting as many arguments as called for
* Uses temporary buffering to improve efficiency.
* _output does the real work here
*
*Entry:
* char *format - format string to control data format/number of arguments
* followed by list of arguments, number and type controlled by
* format string
*
*Exit:
* returns number of characters printed
*
*Exceptions:
*
*******************************************************************************/
int __cdecl printf (
const char *format,
...
)
/*
* stdout 'PRINT', 'F'ormatted
*/
{
va_list arglist;
int buffing;
int retval;
_VALIDATE_RETURN( (format != NULL), EINVAL, -1);
va_start(arglist, format);
_lock_str2(1, stdout);
__try {
buffing = _stbuf(stdout);
retval = _output_l(stdout,format,NULL,arglist);
_ftbuf(buffing, stdout);
}
__finally {
_unlock_str2(1, stdout);
}
return(retval);
}
int __cdecl _printf_l (
const char *format,
_locale_t plocinfo,
...
)
{
va_list arglist;
va_start(arglist, plocinfo);
return _vprintf_l(format, plocinfo, arglist);
}
int __cdecl _printf_s_l (
const char *format,
_locale_t plocinfo,
...
)
{
va_list arglist;
va_start(arglist, plocinfo);
return _vprintf_s_l(format, plocinfo, arglist);
}
int __cdecl printf_s (
const char *format,
...
)
{
va_list arglist;
va_start(arglist, format);
return _vprintf_s_l(format, NULL, arglist);
}
int __cdecl _printf_p_l (
const char *format,
_locale_t plocinfo,
...
)
{
va_list arglist;
va_start(arglist, plocinfo);
return _vprintf_p_l(format, plocinfo, arglist);
}
int __cdecl _printf_p (
const char *format,
...
)
{
va_list arglist;
va_start(arglist, format);
return _vprintf_p_l(format, NULL, arglist);
}
static UINT_PTR __enable_percent_n = 0;
/***
*int _set_printf_count_output(int)
*
*Purpose:
* Enables or disables %n format specifier for printf family functions
*
*Internals:
* __enable_percent_n is set to (__security_cookie|1) for security reasons;
* if set to a static value, an attacker could first modify __enable_percent_n
* and then provide a malicious %n specifier. The cookie is ORed with 1
* because a zero cookie is a possibility.
******************************************************************************/
int __cdecl _set_printf_count_output(int value)
{
int old = (__enable_percent_n == (__security_cookie | 1));
__enable_percent_n = (value ? (__security_cookie | 1) : 0);
return old;
}
/***
*int _get_printf_count_output()
*
*Purpose:
* Checks whether %n format specifier for printf family functions is enabled
******************************************************************************/
int __cdecl _get_printf_count_output()
{
return ( __enable_percent_n == (__security_cookie | 1));
}
第4个回答 2012-06-19
我的printf.c是在这个目录下,你去那里看看。
C:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src\printf.c
如果你还想看VC的头文件的话,推荐一个方法,你写个测试程序,包含那个文件,调用那个文件中的函数,在调试时跟进去,系统就会自动打开那个文件了。
追问我在LCC软件下,没有找到printf生成的目标文件啊
追答所以叫你调试时跟进去看了。
追问我没学调试,不懂啊。书上说,printf是C语言提供的,其编译后的目标文件读者可以找到,那么printf编译后的目标文件在在哪??