C++ Programming/headers
From Wikibooks, the open-content textbooks collection
Contents |
[edit] C standard headers
These standard headers define functions that were originally defined in the C programming language. They make it much easier to port C code to C++.
These are only some of the many C++ Programming/Standard Headers.
[edit] cctype
#include <cctype> int isalnum(int c); int isalpha(int c); int iscntrl(int c); int isdigit(int c); int isgraph(int c); int islower(int c); int isspace(int c); int isprint(int c); int isupper(int c);
[edit] cstring
These cstring functions are almost never used by C++ programmers -- we use the String class instead.
#include <cstring> size_t strlen(char* str); char* strcpy(char* dest, char* src); char* strncpy(char* dest, char* src, size_t length); int strcmp(const char* s1, const char* s2); int strncmp(const char* s1, const char* s2, size_t length); char* strtok(char* str, const char* delim); char* strchr(const char* str, int c); char* strstr(const char* str, const char* within);
[edit] ctime
#include <ctime> clock_t clock(void); double difftime(time_t t1, time_t t0); time_t mktime(struct tm *timeptr); time_t time(time_t *timer); char *asctime(struct tm *timeptr); char *ctime(const time_t *timer); struct tm *gmtime(const time_t *timer); struct tm *localtime(const time_t *timer); size_t strftime(char * s, size_t maxsize, const char * format, struct tm * timeptr); clock_t clock(void); double difftime(time_t t1, time_t t0); time_t mktime(struct tm *timeptr); time_t time(time_t *timer); char *asctime(struct tm *timeptr); char *ctime(const time_t *timer); struct tm *gmtime(const time_t *timer); struct tm *localtime(const time_t *timer); size_t strftime(char * s, size_t maxsize, const char * format, struct tm * timeptr);
[edit] cmath
These cmath functions are heavily used in many kinds of physics simulations -- such as realistic video games, finite element analysis, etc.
#include <cmath>
See C Programming/Further math for details on the trig functions and other floating-point functions implemented in this library.
[edit] climits
This header lists the maximum and minimum values for all the primitive data types used in C++.
#include <climits>
Corresponds to the C language "limits.h". See C Programming/C99 Reference, C Programming/Reference Tables#List of Standard Headers.