Partager via


Required and Optional Headers (Windows Embedded CE 6.0)

1/5/2010

The description of each run-time routine includes a list of required and optional include, or header (.H), files for that routine.

Required header files must be included to obtain the function declaration for the routine or a definition used by another routine called internally. The compiler performs type checking on any routine reference that occurs after its associated function declaration. Function declarations are especially important for routines that return a value of some type other than int, which is the default.

Routines that do not specify their appropriate return value in their declaration are considered by the compiler to return an int, which can cause unexpected results.

The following table shows additional information about the header files that contain declarations for security-enhanced CRT functions.

Header Function

float.h

_controlfp_s

malloc.h

_malloca, _freea

stdio.h

*printf*_s, *scanf*_s, _wfopen_s, clearerr_s, fread_s, _wfreopen_s, _getws_s

stdlib.h

mbstowcs_s, wcstombs_s, _itoa_s, _itow_s, _ltoa_s, _ltow_s, _ultoa_s, _ultow_s, _ecvt_s, _fcvt_s, _gcvt_s, rand_s, qsort_s

string.h

memcpy_s, memmove_s, _*set_s, *cpy_s, *cat_s, strnlen*, _*lwr_s, _*upr_s, *tok_s

Optional Header Files

Optional header files are usually included to take advantage of predefined constants, type definitions, or inline macros.

The following table lists examples of optional header file contents.

Definition Example

Macro definition

If a library routine is implemented as a macro, the macro definition might be in a header file other than the header file for the original routine.

For instance, the towupper macro is defined in the header file Ctype.h, while the function towupper is declared in Stdlib.h.

Manifest constant

Many library routines refer to constants that are defined in header files.

For instance, the _fopen routine uses constants such as _O_CREAT, which is defined in the header file Fcntl.h.

Type definition

Some library routines return a structure or take a structure as an argument.

For example, stream input/output routines use a structure of type FILE, which is defined in Stdio.h.

See Also

Concepts

C Run-Time Library Overview
Run-Time Routines by Category

Other Resources

C/C++ Libraries for Windows Embedded CE