C语言学习趣事_MSCRT_IO_SourceFile (十二)

2014-11-24 00:40:18 · 作者: · 浏览: 295
int len, FILE *f, int *pnumwritten)
#endif
*void write_wstring(wchar_t *string, int len, int *pnumwritten)
*void write_wstring(wchar_t *string, int len, FILE *f, int *pnumwritten)
*
*Purpose:
* Writes a string of the given length to the given file. If no error occurs,
* then *pnumwritten is incremented by len; otherwise, *pnumwritten is set
* to -1. If len is negative, it is treated as zero.
*
*Entry:
* char *string - string to write (NOT null-terminated)
* int len - length of string
* FILE *f - file to write to
* int *pnumwritten - pointer to integer to update with total chars written
*
*Exit:
* No return value.
*
*Exceptions:
*
*******************************************************************************/

#ifdef CPRFLAG

LOCAL(void) write_string (
char *string,
int len,
int *pnumwritten
)
{
while (len-- > 0)
write_char(*string++, pnumwritten);
}

#else /* CPRFLAG */
#if WPRFLAG

LOCAL(void) write_string (
wchar_t *string,
int len,
FILE *f,
int *pnumwritten
)
#else

LOCAL(void) write_string (
char *string,
int len,
FILE *f,
int *pnumwritten
)
#endif /* WPRFLAG */
{
#ifdef _POSIX_
while (len-- > 0) {
write_char(*string++, f, pnumwritten);
if (*pnumwritten < 0)
return;
}
#else
while (len-- > 0)
write_char(*string++, f, pnumwritten);
#endif
}
#endif /* CPRFLAG */


/***
*int get_int_arg(va_list *pargptr)
*
*Purpose:
* Gets an int argument off the given argument list and updates *pargptr.
*
*Entry:
* va_list *pargptr - pointer to argument list; updated by function
*
*Exit:
* Returns the integer argument read from the argument list.
*
*Exceptions:
*
*******************************************************************************/

__inline int _CALLTYPE4 get_int_arg (
va_list *pargptr
)
{
return va_arg(*pargptr, int);
}

/***
*long get_long_arg(va_list *pargptr)
*
*Purpose:
* Gets an long argument off the given argument list and updates *pargptr.
*
*Entry:
* va_list *pargptr - pointer to argument list; updated by function
*
*Exit:
* Returns the long argument read from the argument list.
*
*Exceptions:
*
*******************************************************************************/

#if !LONG_IS_INT
__inline long _CALLTYPE4 get_long_arg (
va_list *pargptr
)
{
return va_arg(*pargptr, long);
}
#endif

#ifdef _ALPHA_
__inline __int64 _CALLTYPE4 get_quad_arg (
va_list *pargptr
)
{
return va_arg(*pargptr, __int64);
}
#endif

#ifndef WPRFLAG
/***
*short get_short_arg(va_list *pargptr)
*
*Purpose:
* Gets a short argument off the given argument list and updates *pargptr.
* *** CURRENTLY ONLY USED TO GET A WCHAR_T, IFDEF _INTL ***
*
*Entry:
* va_list *pargptr - pointer to argument list; updated by function
*
*Exit:
* Returns the short argument read from the argument list.
*
*Exceptions:
*
*******************************************************************************/

#if !SHORT_IS_INT
__inline short _CALLTYPE4 get_short_arg (
va_list *pargptr
)
{
return va_arg(*pargptr, short);
}
#endif
#endif

  发现园子网页代码的一个bug,请管理员注意。

将上面这段代码用另外一种代码上传工具,那么就会提示错误。

摘自 volcanol