TC2.0头文件一览表
- 格式:doc
- 大小:190.50 KB
- 文档页数:27
标准C语言头文件ISOC标准定义的头文件(24项)<assert.h>验证程序断言<complex.h>?支持复数算术运算<ctype.h>?字符类型<errno.h>?出错码<fenv.h>?浮点环境<float.h>?浮点常量<inttypes.h>?整型格式转换<iso646.h>替代关系操作符宏<limits.h>?实现常量<locale.h>?局部类别<math.h>?数学常量<setjmp.h>非局部goto<signal.h>?信号<stdarg.h>?可变参数表<stdbool.h>?布尔类型和值<stddef.h>?标准定义<stdint.h>?整型<stdio.h>?标准I/O库<stdlib.h>?实用程序库函数<string.h>?字符串操作<tgmath.h>?通用类型数学宏<time.h>?时间和日期<wchar.h>?宽字符支持<wctype.h>?宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)<dirent.h>?目录项<fcntl.h>?文件控制<fnmatch.h>?文件名匹配类型<glob.h>?路径名模式匹配类型<grp.h>?组文件<netdb.h>?网络数据库操作<pwd.h>口令文件<regex.h>?正则表达式<tar.h>?tar归档值<termios.h>?终端I/O <unistd.h>?符号常量<utime.h>?文件时间<wordexp.h>?字扩展类型<arpa/inet.h>?Internet定义<net/if.h>?套接字本地接口<netinet/in.h>Internet地址族<netinet/tcp.h>?传输控制协议 <sys/mman.h>?内存管理声明<sys/select.h>?select函数<sys/socket.h>?套接字接口<sys/stat.h>?文件状态<sys/times.h>?进程时间<sys/types.h>?基本系统数据类型<sys/un.h>?UNIX域套接字定义<sys/utsname.h>系统名<sys/wait.h>?进程控制POSIX标准定义的XSI扩展头文件(26项)<cpio.h>cpio归档值<dlfcn.h>?动态链接<fmtmsg.h>?消息显示结构<ftw.h>?文件树漫游<iconv.h>?代码集转换实用程序<langinfo.h>?语言信息常量<libgen.h>?模式匹配函数定义<monetary.h>?货币类型<ndbm.h>?数据库操作<nl_types.h>?消息类别<poll.h>?轮询函数<search.h>?搜索表<strings.h>?字符串操作<syslog.h>?系统出错日志记录<ucontext.h>?用户上下文<ulimit.h>?用户限制<utmpx.h>?用户帐户数据库<sys/ipc.h>IPC<sys/msg.h>?消息队列<sys/resource.h>资源操作<sys/sem.h>?信号量<sys/shm.h>?共享存储<sys/statvfs.h>?文件系统信息<sys/time.h>?时间类型<sys/timeb.h>?附加的时间<sys/uio.h>?矢量I/O操作POSIX标准定义的可选头文件(8项)<aio.h>?异步I/O <mqueue.h>?消息队列<pthread.h>?线程<sched.h>?执行调度<semaphore.h>信号量<spawn.h>?实时spawn接口<stropts.h>?XSISTREAMS接口<trace.h>?时间跟踪标准C++语言头文件(54个其中16个用于构建STL,3个为附加非必须)<algorithm>STL通用算法<bitset>STL位集容器<cassert>?用于在程序运行时执行断言<cctype>字符处理<cerrno>错误码<cfloat>?用于测试浮点类型属性<ciso646>?ISO646变体字符集<climits>?测试整数类型属性<clocale>本地化函数<cmath> 数学函数<complex>复数类<csetjmp>?执行非内部的goto语句<csignal>?信号<cstdarg>?访问参数数量变化的函数<cstddef>?用于定义实用的类型和宏<cstdio>输入/输出<cstdlib>杂项函数及内存分配<cstring>字符串<ctime> 时间<cwchar>宽字符处理及输入/输出<cwctype>宽字符分类<deque>STL双端队列容器<exception>异常处理类<fstream>文件流<functional>STL函数对象<iomanip>参数化输入/输出<ios>基本输入/输出支持<iosfwd>输入/输出前置声明<iostream>数据流输入/输出<istream>基本输入流<iterator>遍历序列的类<limits>各种数据类型最值常量<list>STL线性列表容器<locale>国际化支持<map>STL映射容器<memory>专用内存分配器<new>基本内存分配和释放? <numeric>通用的数字操作<ostream>基本输出流<queue> STL队列容器<set>STL集合容器<sstream>基于字符串的流<stack>STL堆栈容器<stdexcept>标准异常类<streambuf>iostream的缓冲区类<string>字符串类<strstream>?非内存字符序列的流类<typeinfo> 运行时类型标识<utility>STL通用模板类<valarray>?支持值数组的类和模版类<vector>STL动态数组容器标准C++附加的头文件(3个)非必须<hash_map> <hash_set> <slist>TheStandardC++libraryconsistsof51requiredheaders.Thisimplementationalsoincludesthreeaddit ionalheaders,<hash_map>,<hash_set>,and<slist>,notrequiredbytheC++Standard,foratotalof54he aders.Ofthese54headers,16constitutetheStandardTemplateLibrary,orSTL.Theseareindicatedbelo wwiththenotation<algorithm>--(STL)fordefiningnumeroustemplatesthatimplementusefulalgorithms<bitset> --fordefiningatemplateclassthatadministerssetsofbits<complex> --fordefiningatemplateclassthatsupportscomplexarithmetic<deque>--(STL)fordefiningatemplateclassthatimplementsadequecontainer<exception>--fordefiningseveralfunctionsthatcontrolexceptionhandling<fstream> --fordefiningseveraliostreamstemplateclassesthatmanipulateexteralfiles<functional>--(STL)fordefiningseveraltemplatesthathelpconstructpredicatesfor thetemplatesdefinedin<algorithm>and<numeric><hash_map>--(STL)fordefiningtemplateclassesthatimplementhashedassociativecontainers thatmapkeystovalues<hash_set>--(STL)fordefiningtemplateclassesthatimplementhashedassociativecontainers<iomanip> --fordeclaringseveraliostreamsmanipulatorsthattakeanargument<ios> --fordefiningthetemplateclassthatservesasthebaseformanyiostreamsclasses<iosfwd> --fordeclaringseveraliostreamstemplateclassesbeforetheyarenecessarilydefined<iostream> --fordeclaringtheiostreamsobjectsthatmanipulatethestandardstreams<istream> --fordefiningthetemplateclassthatperformsextractions<iterator>--(STL)fordefiningseveraltemplatesthathelpdefineandmanipulateiterators<limits> --fortestingnumerictypeproperties<list>--(STL)fordefiningatemplateclassthatimplementsadoublylinkedlistcontainer<locale> --fordefiningseveralclassesandtemplatesthatcontrollocale-specificbehavior,asintheiostreamsclasses<map>--(STL)fordefiningtemplateclassesthatimplementassociativecontainersthat mapkeystovalues<memory>--(STL)fordefiningseveraltemplatesthatallocateandfreestorageforvarious containerclasses<new> --fordeclaringseveralfunctionsthatallocateandfreestorage<numeric>--(STL)fordefiningseveraltemplatesthatimplementusefulnumericfunctions<ostream> --fordefiningthetemplateclassthatperformsinsertions<queue>--(STL)fordefiningatemplateclassthatimplementsaqueuecontainer<set>--(STL)fordefiningtemplateclassesthatimplementassociativecontainers<slist>--(STL)fordefiningatemplateclassthatimplementsasinglylinkedlistcontainer<sstream>--fordefiningseveraliostreamstemplateclassesthatmanipulatestringcontainers<stack>--(STL)fordefiningatemplateclassthatimplementsastackcontainer<stdexcept>--fordefiningseveralclassesusefulforreportingexceptions<streambuf>--fordefiningtemplateclassesthatbufferiostreamsoperations<string> --fordefiningatemplateclassthatimplementsastringcontainer<strstream>--fordefiningseveraliostreamsclassesthatmanipulatein-memorycharacter sequences<typeinfo> --fordefiningclasstype_info,theresultofthetypeidoperator<utility>--(STL)fordefiningseveraltemplatesofgeneralutility<valarray> --fordefiningseveralclassesandtemplateclassesthatsupportvalue-oriented arrays<vector>--(STL)fordefiningatemplateclassthatimplementsavectorcontainer新的C标准库<cassert> --forenforcingassertionswhenfunctionsexecute<cctype> --forclassifyingcharacters<cerrno> --fortestingerrorcodesreportedbylibraryfunctions<cfloat> --fortestingfloating-pointtypeproperties<ciso646> --forprogramminginISO646variantcharactersets<climits> --fortestingintegertypeproperties<clocale> --foradaptingtodifferentculturalconventions<cmath> --forcomputingcommonmathematicalfunctions<csetjmp> --forexecutingnonlocalgotostatements<csignal> --forcontrollingvariousexceptionalconditions<cstdarg> --foraccessingavaryingnumberofarguments<cstddef> --fordefiningseveralusefultypesandmacros<cstdio> --forperforminginputandoutput<cstdlib> --forperformingavarietyofoperations<cstring> --formanipulatingseveralkindsofstrings<ctime> --forconvertingbetweenvarioustimeanddateformats<cwchar> --formanipulatingwidestreamsandseveralkindsofstrings<cwctype> --forclassifyingwidecharacters旧的C标准库<assert.h> --forenforcingassertionswhenfunctionsexecute<ctype.h> --forclassifyingcharacters<errno.h> --fortestingerrorcodesreportedbylibraryfunctions<float.h> --fortestingfloating-pointtypeproperties<iso646.h> --forprogramminginISO646variantcharactersets<limits.h> --fortestingintegertypeproperties<locale.h> --foradaptingtodifferentculturalconventions<math.h> --forcomputingcommonmathematicalfunctions<setjmp.h> --forexecutingnonlocalgotostatements<signal.h> --forcontrollingvariousexceptionalconditions<stdarg.h> --foraccessingavaryingnumberofarguments<stddef.h> --fordefiningseveralusefultypesandmacros<stdio.h> --forperforminginputandoutput<stdlib.h> --forperformingavarietyofoperations<string.h> --formanipulatingseveralkindsofstrings<time.h> --forconvertingbetweenvarioustimeanddateformats<wchar.h> --formanipulatingwidestreamsandseveralkindsofstrings<wctype.h> --forclassifyingwidecharactersFinally,inthisimplementation,theStandardC++libraryalsoincludesseveralheadersforcompatibil itywithtraditionalC++libraries:<fstream.h>--fordefiningseveraliostreamstemplateclassesthatmanipulateexteralfiles<iomanip.h>--fordeclaringseveraliostreamsmanipulatorsthattakeanargument<iostream.h>--fordeclaringtheiostreamsobjectsthatmanipulatethestandardstreams<new.h> --fordeclaringseveralfunctionsthatallocateandfreestorage<stl.h> --fordeclaringseveraltemplateclassesthataidmigrationfromolderversions oftheStandardTemplateLibrary。
标准C语言头文件ISO C标准定义的头文件24项<assert.h> 验证程序断言<complex.h> 支持复数算术运算<ctype.h> 字符类型<errno.h> 出错码<fenv.h> 浮点环境<float.h> 浮点常量<inttypes.h> 整型格式转换<iso646.h> 替代关系操作符宏<limits.h> 实现常量<locale.h> 局部类别<math.h> 数学常量<setjmp.h> 非局部goto<signal.h> 信号<stdarg.h> 可变参数表<stdbool.h> 布尔类型和值<stddef.h> 标准定义<stdint.h> 整型<stdio.h> 标准I/O 库<stdlib.h> 实用程序库函数<string.h> 字符串操作<tgmath.h> 通用类型数学宏<time.h> 时间和日期<wchar.h> 宽字符支持<wctype.h> 宽字符分类和映射支持POSIX标准定义的必须的头文件26项<dirent.h> 目录项<fcntl.h> 文件控制<fnmatch.h> 文件名匹配类型<glob.h> 路径名模式匹配类型<grp.h> 组文件<netdb.h> 网络数据库操作<pwd.h> 口令文件<regex.h> 正则表达式<tar.h> tar归档值<termios.h> 终端I/O <unistd.h> 符号常量<utime.h> 文件时间<wordexp.h> 字扩展类型<arpa/inet.h> Internet定义<net/if.h> 套接字本地接口<netinet/in.h> Internet地址族 <netinet/tcp.h> 传输控制协议<sys/mman.h> 内存管理声明<sys/select.h> select函数<sys/socket.h> 套接字接口<sys/stat.h> 文件状态<sys/times.h> 进程时间<sys/types.h> 基本系统数据类型<sys/un.h> UNIX 域套接字定义<sys/utsname.h>系统名<sys/wait.h> 进程控制POSIX标准定义的XSI扩展头文件26项<cpio.h> cpio归档值<dlfcn.h> 动态链接<fmtmsg.h> 消息显示结构<ftw.h> 文件树漫游<iconv.h> 代码集转换实用程序<langinfo.h> 语言信息常量<libgen.h> 模式匹配函数定义<monetary.h> 货币类型<ndbm.h> 数据库操作<nl_types.h> 消息类别<poll.h> 轮询函数<search.h> 搜索表<strings.h> 字符串操作<syslog.h> 系统出错日志记录<ucontext.h> 用户上下文<ulimit.h> 用户限制<utmpx.h> 用户帐户数据库<sys/ipc.h> IPC <sys/msg.h> 消息队列<sys/resource.h> 资源操作<sys/sem.h> 信号量<sys/shm.h> 共享存储<sys/statvfs.h> 文件系统信息<sys/time.h> 时间类型<sys/timeb.h> 附加的时间<sys/uio.h> 矢量I/O操作POSIX标准定义的可选头文件8项<aio.h> 异步I/O <mqueue.h> 消息队列<pthread.h> 线程<sched.h> 执行调度<semaphore.h> 信号量<spawn.h> 实时spawn接口<stropts.h> XSI STREAMS接口<trace.h> 时间跟踪标准 C++ 语言头文件54个其中16个用于构建STL;3个为附加非必须<algorithm> STL通用算法<bitset> STL位集容器<cassert> 用于在程序运行时执行断言<cctype> 字符处理<cerrno> 错误码<cfloat> 用于测试浮点类型属性<ciso646> ISO646变体字符集<climits> 测试整数类型属性<clocale> 本地化函数<cmath> 数学函数<complex> 复数类<csetjmp> 执行非内部的goto语句<csignal> 信号<cstdarg> 访问参数数量变化的函数<cstddef> 用于定义实用的类型和宏<cstdio> 输入/输出<cstdlib> 杂项函数及内存分配<cstring> 字符串<ctime> 时间<cwchar> 宽字符处理及输入/输出<cwctype> 宽字符分类<deque> STL双端队列容器<exception> 异常处理类<fstream> 文件流<functional> STL函数对象<iomanip> 参数化输入/输出<ios> 基本输入/输出支持<iosfwd> 输入/输出前置声明<iostream> 数据流输入/输出<istream> 基本输入流<iterator> 遍历序列的类<limits> 各种数据类型最值常量<list> STL 线性列表容器<locale> 国际化支持<map> STL映射容器<memory> 专用内存分配器<new> 基本内存分配和释放<numeric> 通用的数字操作<ostream> 基本输出流<queue> STL 队列容器<set> STL 集合容器<sstream> 基于字符串的流<stack> STL 堆栈容器<stdexcept> 标准异常类<streambuf> iostream 的缓冲区类<string> 字符串类<strstream> 非内存字符序列的流类<typeinfo>运行时类型标识<utility> STL 通用模板类<valarray> 支持值数组的类和模版类<vector> STL 动态数组容器标准C++附加的头文件3个非必须<hash_map> <hash_set> <slist>The Standard C++ library consists of 51 required headers.This implementation also includes three additional headers;<hash_map>;<hash_set>;and <slist>;not required by the C++ Standard; for a total of 54 headers.Of these 54 headers;16 constitute the Standard Template Library; or STL.These are indicated below with the notation<algorithm> -- STL for defining numerous templates that implement useful algorithms<bitset> -- for defining a template class that administers sets of bits<complex> -- for defining a template class that supports complex arithmetic <deque> -- STL for defining a template class that implements a deque container<exception> -- for defining several functions that control exception handling <fstream> -- for defining several iostreams template classes that manipulate exteral files<functional> -- STL for defining several templates that help construct predicates forthe templates defined in <algorithm> and <numeric> <hash_map>-- STL for defining template classes that implement hashed associative containersthat map keys to values<hash_set>-- STL for defining template classes that implement hashed associative containers<iomanip> -- for declaring several iostreams manipulators that take an argument<ios> -- for defining the template class that serves as the base for many iostreams classes<iosfwd> -- for declaring several iostreams template classes before they are necessarilydefined<iostream> -- for declaring the iostreams objects that manipulate the standard streams<istream> -- for defining the template class that performs extractions <iterator>-- STL for defining several templates that help define and manipulate iterators<limits> -- for testing numeric type properties<list>-- STL for defining a template class that implements a doubly linked list container<locale> -- for defining several classes and templates that controllocale-specific behavior; as in the iostreams classes<map>-- STL for defining template classes that implement associative containers thatmap keys to values<memory>-- STL for defining several templates that allocate and free storage for variouscontainer classes<new> -- for declaring several functions that allocate and free storage <numeric>-- STL for defining several templates that implement useful numeric functions<ostream> -- for defining the template class that performs insertions <queue> -- STL for defining a template class that implements a queue container<set>-- STL for defining template classes that implement associative containers<slist>-- STL for defining a template class that implements a singly linked list container<sstream> -- for defining several iostreams template classes that manipulate string containers<stack> -- STL for defining a template class that implements a stack container<stdexcept> -- for defining several classes useful for reporting exceptions <streambuf> -- for defining template classes that buffer iostreams operations <string> -- for defining a template class that implements a string container <strstream> -- for defining several iostreams classes that manipulatein-memory charactersequences<typeinfo> -- for defining class type_info; the result of the typeid operator <utility>-- STL for defining several templates of general utility<valarray> -- for defining several classes and template classes that support value-orientedarrays<vector>-- STL for defining a template class that implements a vector container新的C标准库<cassert> -- for enforcing assertions when functions execute<cctype> -- for classifying characters<cerrno> -- for testing error codes reported by library functions<cfloat> -- for testing floating-point type properties<ciso646> -- for programming in ISO 646 variant character sets<climits> -- for testing integer type properties<clocale> -- for adapting to different cultural conventions<cmath> -- for computing common mathematical functions<csetjmp> -- for executing nonlocal goto statements<csignal> -- for controlling various exceptional conditions<cstdarg> -- for accessing a varying number of arguments<cstddef> -- for defining several useful types and macros<cstdio> -- for performing input and output<cstdlib> -- for performing a variety of operations<cstring> -- for manipulating several kinds of strings<ctime> -- for converting between various time and date formats<cwchar> -- for manipulating wide streams and several kinds of strings <cwctype> -- for classifying wide characters旧的C标准库<assert.h> -- for enforcing assertions when functions execute<ctype.h> -- for classifying characters<errno.h> -- for testing error codes reported by library functions<float.h> -- for testing floating-point type properties<iso646.h> -- for programming in ISO 646 variant character sets<limits.h> -- for testing integer type properties<locale.h> -- for adapting to different cultural conventions<math.h> -- for computing common mathematical functions<setjmp.h> -- for executing nonlocal goto statements<signal.h> -- for controlling various exceptional conditions<stdarg.h> -- for accessing a varying number of arguments<stddef.h> -- for defining several useful types and macros<stdio.h> -- for performing input and output<stdlib.h> -- for performing a variety of operations<string.h> -- for manipulating several kinds of strings<time.h> -- for converting between various time and date formats<wchar.h> -- for manipulating wide streams and several kinds of strings<wctype.h> -- for classifying wide charactersFinally; in this implementation; the Standard C++ library also includes several headers for compatibility with traditional C++ libraries:<fstream.h> -- for defining several iostreams template classes that manipulate exteral files<iomanip.h> -- for declaring several iostreams manipulators that take an argument<iostream.h> -- for declaring the iostreams objects that manipulate the standard streams<new.h> -- for declaring several functions that allocate and free storage <stl.h> -- for declaring several template classes that aid migration from older versionsof the Standard Template Library。
*Ambiguous operators need parentheses :不明确的运算,需要用括号括起来*Ambiguous symbol 'xxx' :不明确的符号*Argument list syntax error :参数表语法错误*Array bounds missing :丢失数组界限符*Array size too large :数组尺寸太大*Bad character in parameters :参数中有不适当的字符*Bad file name format in include directive :包含命令中文件名格式不正确*Bad ifdef directive syntax :编译预处理ifdef有语法错误*Bad ifndef directive syntax :编译预处理ifndef有语法错误*Bad undef directive syntax :编译预处理undef有语法错误*Bit field too large :位字段太长*Call of non-function :调用未定义的函数*Call to function with no prototype :调用函数时没有函数的说明*Cannot modify a const object :不允许修改常量对象*Case outside of switch :Case 出现在 switch 之外*Case statement missing :漏掉了 Case 语句*Case syntax error :Case 语法错误*Code has no effect :代码不可能执行到*Compound statement missing } :复合语句漏掉了"}"*Conflicting type modifiers :不明确的类型说明符*Constant expression required :要求常量表达式*Constant out of range in comparison :在比较中常量超出范围*Conversion may lose significant digits :转换时会掉失有意义的数字*Conversion of near pointer not allowed :不允许转换返指针*Could not find file 'xxx' :找不到xxx文件*Declaration missing ; :说明缺少分号";"*Declaration syntax error :说明中出现语法错误*Default outside of switch :default出现在switch语句之外*Define directive needs an identifier :定义编译预处理需要标识符*Division by zero :用零作除数*Do statement must have while :do-while语句中缺少while部分*Enum syntax error :枚举类型语法错误*Enumeration constant syntax error :枚举常数语法错误*Error directive:xxx :错误的编译预处理命令*Error writing output file :写输出文件错误*Expression syntax error :表达式语法错误*Extra parameter in call :调用时出现多余错误*File name too long :文件名太长*Function call missing ) :函数调用缺少右括号*Function definition out of place :函数定义位置错误*Function should return a value :函数返回一个值*Goto statement missing label :goto 语句没有标号*Hexadecimal or octal constant too large :16进制或8进制常数太大*Illegal character 'x' :非法字 x*Illegal initialization :非法的初始化*Illegal octal digit :非法的8进制数字*Illegal pointer subtraction :非法的指针相减*Illegal structure operation :非法的结构体操作*Illegal use of floating point :非法的浮点运算*Illegal use of pointer :指针使用非法*Improper use of a typedef symbol :类型符号定义使用不恰当*Incompatible storage class :存储类别不相容*Incompatible type conversion :不相容的类型转换*Incorrect number format :错误的数据格式*Incorrect use of default :default使用不正确*In-line assembly not allowed :不允许使用行间汇编*Invalid indirection :无效的间接运算*Invalid pointer addition :指针相加无效*Irreducible expression tree :无法执行的表达式运算*Lvalur required :需要逻辑值(0或非0值)*Macro argument syntax error :宏参数语法错误*Macro expansion too long :宏的扩展以后太长*Mismatched number of parameters in definition :定义中参数个数不匹配*Misplaced break :此处不应出现break语句*Misplaced continue :此处不应出现continue语句*Misplaced decimal point :此处不应出现小数点*Misplaced elif directive :此处不应出现编译预处理elif*Misplaced else :此处不应出现else*Misplaced else directive :此处不应出现编译预处理 else*Misplaced endif directive :此处不应出现编译预处理 endif*Must be addressable :必须是可以编址的*Must take address of memory location :必须存储定位的地址*No declaration for function 'xxx' :没有函数 xxx 的说明*No stack :缺少堆栈*NO type information :没有类型信息*Non-portable pointer assignment :不可移动的指针(地址常数)赋值*Non-portable pointer comparison :不可移动的指针(地址常数)比较*Non-portable pointer conversion :不可移动的指针(地址常数)转换*Not a valid expression format type :不合法的表达式格式*Not an allowed type :不允许使用的类型*Numeric constant too large :数值常数太大*Out of memory :内存不够用*Parameter 'xxx' is never used :参数 xxx 没有用到*Pointer required on left side of -> :-> 符号的左边必须是指针*Possible use of 'xxx' before definition :在定义之前就使用了 xxx(警告) *Possibly incorrect assignment :赋值可能不正确*Redeclaration of 'xxx' :重复定义了 xxx*Redefinition of 'xxx' is not identical :xxx 的两次定义不一致*Register allocation failure :寄存器定址失败*Repeat count needs an lvalue :重复计数需要逻辑值*Size of structure or array not known :结构体或数组的大小不确定*Statement missing ; :语句后缺少";"*Structure or union syntax error :结构体或联合体语法错误*Structure size too large :结构体的尺寸太大*Subscripting missing ] :下标缺少右方括号*Superfluous &with function or array :函数或数组中有多余的"&"*Suspicious pointer conversion :可疑的指针转换*Symbol limit exceeded :符号超限*Too consecutive dots :两个连续的句点*Too few parameters in call :函数调用时的实参少于函数的参数*Too many default cases :default太多(switch语句中只有一个)*Too many error or warning messages :错误或警告信息太多*Too many types in declaration :说明中类型太多*Too much auto memory in function :函数中用到的局部存储太多*Too much global data defined in file :文件中全局数据太多*Type mismatch in parameter xxx :参数xxx类型不匹配*Type mismatch in redeclaration of 'xxx' :xxx 重定义时的类型不匹配*Unable to create output file 'xxx' :无法建立输出文件 xxx*Unable to open include file 'xxx' :无法打开被包容的文件 xxx*Unable to open input file 'xxx' :无法打开输入文件 xxx*Undefined label 'xxx' :没有定义的标号 xxx*Undefined structure 'xxx' :没有定义的结构 xxx*Undefined symbol 'xxx' :没有定义的符号 xxx*Unexpected end of file in comment started on line xxx:从 xxx 行开始的注解尚未结束,文件不能结束*Unexpected end of file in conditional started on line xx:从xx行开始的条件语句尚未结束,文件不能结束*Unknown assembler instruction :未知的汇编结构*Unknown option :未知的操作*Unknown preprocessor directive:'xxx' :不认识的预处理命令 xxx*Unreachable code :无路可达的代码*Unterminated string or character constant :字符串缺少引号*User break :用户强行中断了程序*Void functions may not return a value :void 类型的函数不应有返回值*Wrong number off arguments :调用函数时参数数目错*'xxx' declared but never used :说明了 xxx ,但没有使用*'xxx' is assigned a value which is never used :给 xxx 赋了值,但未用过*'xxx' not an argument :xxx 不是参数*'xxx' not part of structure :xxx 不是结构体的一部分*xxx statement missing ( :xxx 语句缺少左括号*xxx statement missing ) :xxx 语句缺少右括号*xxx statement missing ; :xxx 语句缺少分号*Zero length structure :结构体的长度为零。
Turbo C 2.0的使用及常见错误Turbo C 2.0 快捷键F1 help 打开帮助F2 save 保存文件F3 load 打开文件F4 go to cursor 运行到光标F5 zoom 缩放窗口F6 switch 窗口间切换F7 trace into 跟踪执行(进入函数)F8 step over 单步跟踪(不进入函数)F9 make 构建文件F10 menu 菜单Alt+F9 编译F9 编译并连接Ctrl+F9 运行Alt+F5: 查看输出Ctrl+F7 Watch查看变量Ctrl+F8 断点Ctrl+F4 查看变量,可改值Ctrl+F3 call stack 调用堆Alt+F3 最近打开的文件Alt+X 退出Ctrl+F2 中止调试设置环境:Options -> DirectoriesInclude directories: Include头文件所在目录Library directories: Lib库文件所在目录Output directory: 临时文件和最终EXE文件输出目录Turbo C directory: TC所在目录不保存备份BAK文件:Options -> Environment -> Backup files = Off 保存设置:Save options。
TCCONFIG.TC=======================================Turbo C 2.0 主要组成文件说明./INCLUDE 头文件所在目录*.H Turbo C头文件./LIB 库文件所在目录C0?.OBJ 不同模式启动代码C?.LIB 不同模式运行库其中: 上面的?分别为:T Tiny(微型模式)S Small(小模式)C Compact(紧凑模式)M Medium(中型模式)L Large(大模式)H Huge(巨大模式)*.C Turbo C例行程序(源文件)*.BGI 不同显示器图形驱动程序INSTALL.EXE 安装程序文件TC.EXE 集成编译TCINST.EXE 集成开发环境的配置设置程序TCHELP.TCH 帮助文件 读取TCHELP.TCH的驻留程序README 关于Turbo C的信息文件TCCONFIG.EXE 配置文件转换程序MAKE.EXE 项目管理工具TCC.EXE 命令行编译TLINK.EXE Turbo C系列连接器TLIB.EXE Turbo C系列库管理工具GRAPHICS.LIB 图形库EMU.LIB 8087仿真库FP87.LIB 8087库=======================================Turbo C 2.0 程序的输入、编译和运行C语言是一种中级语言, 用户用C语言编写的程序称为源程序, 存放用C 语言所写源程序文件名字最后的两个字符一般必须为".c"。
TC2.0错误提示(C目信息)Call of non-function调用非函数Call of clipper procedure of function调用的函数没有原型Call of function 'xxxx' with no prototype调用的函数'xxx' 没有原型Can't cast objects as "far""far" 关键字不能用在类型强制转换中Can't cast objects as "near""near" 关键字不能用在类型强制转换中Cannot find file无法找到该文件Cannot generate COM file :data below initial CS:IP defined无法生成COM 文件,初始CS:IP已定义过Cannot generate COM file :invalid initial entry piont address无法生成COM 文件,初始入口点地址无效Cannot generate COM file :program exceeds 64K无法生成COM 文件,程序超过了64KCannot generate COM file :segment-relocatable items present无法生成COM 文件Cannot generate COM file :stack segment present无法生成COM 文件Cannot grow LE/LIDATA record buffer不能建立LE/LIDATA 记录缓冲区Cannot have mulitiple paths for implicit rule在隐式规则中,不能有多个路径Cannot have path list for target不能有目标路径表Cannot initialize indetiifer skip to这里无法初始化一个类成员Cannot modfiy a const object不能修改一个const目标Cannot overload /main/main 主函数不能重载Cannot use reserved DOS device name for file不能使用保留的DOS 设备名Cannot use tiny or luge memory model with windows不能使用小或大的内存模式窗口Cannot write GRPOEF list,extended dictionary aborted 不能写GRPOEF 列表,扩展字典中断Case bypasses initialization of a local variable跳过局部变量初始化是非法的Case expression not constantcase 语句的表达式不是常量Case expression not integralcase 语句的表达式不是整型Case of "viiod" term to non-viodviod类型不能被强制转换成任何其他类型Case outside of switchcase 或case 语句在switch 语句外面Case statement missing ':'case 语句缺少':'Case syntax errorcase 语法错Case to array type is illegal不能被强制转换为数组类型Case to function returning... is illegal不能被强制转换为函数类型Case value "n" already usedcase 情况值n 已使用过Character already used指定的关键字表标识符已经在使用Character constant must be one or two character long 字符常量须是一个或两个字符长Character constant too long字符常量太长Character 'K' and 'k' cannot be used不能使用字符'K' 和'k'Circular dependency exists in makefile在makefile中已存在循环依赖Class may not contain pure function(class) 类不可以包含纯函数Class member declared outside its class(case) 类成员函数不能在类说明里说明Code has no effect操作符代码无用Colon expected ':'需要':'Command argument too long命令参数太多Command syntax error命令语法错误Compiler could not generate Copy constructor for Class 编译器不能生成所需的拷贝构造函数Compiler could not generate Default constructor for Class 编译器不能生成所需的缺省构造函数Compiler could not generate oprator = for Class编译器不能生成所需的赋值运算符Compiler error (assertion) :filename,line n source = filename编译程序错误(一致性)文件名,文件,行号,源=文件名Compiler error (code engenration)编译程序错误(代码不能生成)Compiler limit too many actual parameters for macro编译程序限制: 宏的实参数太多Compiler limits : Initializers too deeply nested编译程序限制: 初始值镶嵌太深Compiler limit : struct / union nesting编译程序限制: 结构/联和嵌套Compiler table limit exceeded编译器内部表之一溢出Compound statement missing }编译器一直到文件结束也没找到}Compound statement missing '}'复和语句缺少}Condition is always falseCondition is always true条件总是假或条件总是真Conflicting type modfilers类型修饰符相冲突Const expression required数组长度须用常量定义Constant expression is not integral此处需要一个整数型常量表达式Constant expression required要求常量表达式Constant is long常量太长Constant member in class without constructors类的常量成员没有包含用户的构造函数Constant member is not initialized常量成员没有被出始化Constant out of range in comparision在比较中常数超界常量表达式超出了比较的范围Constant variable must be initialized可变常数须出始化Constructor cannot be declared const or volatile不能把构造函数说明为const或volatileConstructor cannot have a return type specification构造函数不能有一个返回类型说明Constructor is not a base class of classconstructor 不是class 的一个基类Context member already used in \[MAP]\ section上下文号在\[MAP]\ 节中被使用Context string name already assigned an alias指定的上下文串已被加了别名Context string already used in file上下文串在文件内已使用过Context string cannot be used alias别名字符串不能使用上下文件字符串Context string defined for index topic is unresolved为索引标题定义的上下文串是不可分解的Context string identifier already defined in topicof上下文串标识符在文件主题中已被定义过Context sting in MAP section not defined in any topic主题内定义MAP 节的上下文串Context string missing丢失了上下文串Conversion may lose significant digits转换操作可能丢失了有效值Conversion operator canot have a reutrn type specification 转换运算符不能有返回类型说明Conversion to type will fail for members of virtual base没有成员指针的类包含虚拟基,转换为另一类型将失败Could not allocate memory for per module data不能为每一个模块数据分配内存Could not create list file不能创建列表文件Could not find a match for argument(s)不能找到与提供的参数相匹配的函数Could not fined 'xxx.xxx'不能找到文件'xxx.xxx'Could not found file不能找到命令行里给出的文件Could not write executable不能写输出文件Couldn't get LE/LIDTA record buffer不能找到LE/LIDTA 记录缓冲区Coversion may lose significance digit bit转换可能丢失有效数据位Current font range overlaps previosly defined range 当前字体范围覆盖了前面定义过的范围。
在使用tc编写程序时,你或许对其中的*.lib文件产生疑问,这些lib文件有什么用途?用C 语言编程时,通常要建立一些用户函数。
如果这些函数具有通用性,一般的方法是将它们作成头文件,当需要时用“#include”命令将其包含到源程序之中,以提高编程效率。
但在特定的程序中一般仅使用这些函数的一部分,若用上述方法包含所有函数,编译器在编译的时候会把所有包含进的函数都进行编译,这无疑会使源程序变得庞大而难于理解,并会影响执行效率。
建立用户目标模块库(lib文件)可以解决这个问题,你可以事先把有特定功能的通用的子函数集编译完成后生成的obj文件打入lib文件,当链接器tlink.exe在进行链接操作时,便只会把程序内部用到的通用函数所在的obj文件链接进来(已验证:不能定位到具体函数),这样生成的obj文件便会更精简,生成的exe文件也更小。
其实,一个lib文件是obj文件的集合。
当然,其中还夹杂着其他一些辅助信息,目的是为了让编译器能够准确找到对应的obj文件。
我们可以通过tlib.exe(在tc2.0下的根目录)来对lib文件进行操作,你可以把自己生成的obj文件通过tlib命令加入到一个lib文件中,也可以把lib文件内的obj文件进行删除操作,还可以把内部的obj文件给提取出来。
明白了lib文件的大致结构以及对它的具体操作,在学习C语言的过程中,就会又多了一个切入点对C语言具体实现进行研究。
在command下,把当前目录设置为tlib.exe所在目录,然后输入tlib命令回车,此时显示的内容就是对tlib命令的详细解释,语法如下:Syntax: TLIB libname [/C] [/E] commands, listfilelibname library file pathnamecommands sequence of operations to be performed (optional)listfile file name for listing file (optional)A command is of the form: <symbol>modulename, where <symbol> is:+ add modulename to the library- remove modulename from the library* extract modulename without removing it-+ or +- replace modulename in library-* or *- extract modulename and remove it/C case-sensitive library/E create extended dictionary具体解释:tlib libname [/C] [/E] commands, listfile/C:大小写敏感标志。
c中内存分配与释放(malloc,realloc,calloc,free)函数内容的整理malloc:原型:extern void *malloc(unsigned int num_bytes); 头文件:在TC2.0中可以用malloc.h 或alloc.h (注意:alloc.h 与malloc.h 的内容是完全一致的),而在Visual C++6.0中可以用malloc.h或者stdlib.h。
功能:分配长度为num_bytes字节的内存块返回值:如果分配成功则返回指向被分配内存的指针(此存储区中的初始值不确定),否则返回空指针NULL。
当内存不再使用时,应使用free()函数将内存块释放。
函数返回的指针一定要适当对齐,使其可以用于任何数据对象。
说明:关于该函数的原型,在旧的版本中malloc 返回的是char型指针,新的ANSIC标准规定,该函数返回为void型指针,因此必要时要进行类型转换。
名称解释:malloc的全称是memory allocation,中文叫动态内存分配。
函数声明void *malloc(size_t size); 说明:malloc 向系统申请分配指定size个字节的内存空间。
返回类型是void* 类型。
void* 表示未确定类型的指针。
C,C++规定,void* 类型可以强制转换为任何其它类型的指针。
备注:void* 表示未确定类型的指针,更明确的说是指申请内存空间时还不知道用户是用这段空间来存储什么类型的数据(比如是char还是int或者...)从函数声明上可以看出。
malloc 和new 至少有两个不同: new 返回指定类型的指针,并且可以自动计算所需要大小。
比如:int *p; p = new int; //返回类型为int* 类型(整数型指针),分配大小为sizeof(int); 或:int* parr; parr = new int [100]; //返回类型为int* 类型(整数型指针),分配大小为sizeof(int) * 100; 而malloc 则必须要由我们计算字节数,并且在返回后强行转换为实际类型的指针。
对于初学程序设计的人来说Turbo C 2.0无疑是最简单最理想的入门语言环境之一,但也常由于环境变量设置的不正确导致程序无法编译运行,严重打击了初学者来之不易的自信心。
为了迅速解决此类问题,使大家能把精力集中到程序设计上来,我们特地编写本文以帮助有心涉足编程领域的初学者。
1.准备TC2.0下载之后的工作就是解压缩了,解压缩可以使用WinZip或WinRar。
在此我们假设将TC 解压到"x:\TC20"目录(x表示盘符),当然您也可以将它解压到任意目录,例如 "D:\Programing\C\TC20",此时请使用"D:\Programing\C\TC20"替换以下设置过程中出现的"x:\TC20"。
2.建立Output目录Output目录用来存放使用TC编写的执行文件和编译过程中使用的临时文件,虽然该目录不一定要有,但为了使您今后可能编写的大量应用程序便于管理,我们强烈建议您建立此目录。
下面将分别介绍DOS模式和Windows窗口模式下的操作方法。
2.1、DOS模式下的操作方法:首先进入TC所在目录,示例如下:C:\>x:x:\>cd TC20然后创建目录:x:\TC20\>md Output2.2、Windows下的操作方法:使用资源管理器或我的电脑打开TC所在目录,右键点击空白空间,在弹出的右键菜单中选择"新建(W)->文件夹(F)"(该操作表示先选择 "新建(W)",再在弹出的子菜单中选择"文件夹(F)"),再将文件夹名称改为Output。
当然您可以用任何名称的目录作为Output目录,但请切记要在后面的几步中作相应的变动才能使设置生效。
3.设置TC环境变量首先运行TC目录下的TC.exe,这是TC2.0编译环境的主程序,按F10键打开主菜单,选取其中的"Options->Directories",所要设定各选项对应意义如下:Include directories: Include头文件所在目录Library directories: Lib库文件所在目录Output directory: 临时文件和最终EXE文件输出目录Turbo C directory: TC所在目录按照我们前边的目录结构,这里应如下设置:Include directories: x:\TC20\INCLUDELibrary directories: x:\TC20\LIBOutput directory: x:\TC20\OUTPUTTurbo C directory: x:\TC20如果将TC解压到其他目录下的话,请相应修改设置4.保存设置为了省去每次启动TC后都要进行设置,在完成以上步骤之后还要将设置结果存盘,具体的操作是选择菜单"Options->Save options"。
标准C语言头文件ISO C标准概念的头文件(24项)<> 验证程序断言<> 支持复数算术运算<> 字符类型<> 犯错码<> 浮点环境<> 浮点常量<> 整型格式转换<> 替代关系操作符宏<> 实现常量<> 局部类别<> 数学常量<> 非局部goto<> 信号<> 可变参数表<> 布尔类型和值<> 标准概念<> 整型<> 标准I/O库<> 有效程序库函数<> 字符串操作<> 通用类型数学宏<> 时刻和日期<> 宽字符支持<> 宽字符分类和映射支持POSIX标准概念的必需的头文件(26项)<> 目录项<> 文件操纵<> 文件名匹配类型<> 途径名模式匹配类型<> 组文件<> 网络数据库操作<> 口令文件<> 正那么表达式<> tar归档值<> 终端I/O <> 符号常量<> 文件时刻<> 字扩展类型<arpa/> Internet概念<net/> 套接字本地接口<netinet/> Internet地址族<netinet/> 传输操纵协议<sys/> 内存治理声明<sys/> select函数<sys/> 套接字接口<sys/> 文件状态<sys/> 进程时刻<sys/> 大体系统数据类型<sys/> UNIX域套接字概念<sys/>系统名<sys/> 进程操纵POSIX标准概念的XSI扩展头文件(26项)<> cpio归档值<> 动态链接<> 消息显示结构<> 文件树漫游<> 代码集转换有效程序<> 语言信息常量<> 模式匹配函数概念<> 货币类型<> 数据库操作<> 消息类别<> 轮询函数<> 搜索表<> 字符串操作<> 系统犯错日记记录<> 用户上下文<> 用户限制<> 用户帐户数据库<sys/> IPC<sys/> 消息队列<sys/> 资源操作<sys/> 信号量<sys/> 共享存储<sys/> 文件系统信息<sys/> 时刻类型<sys/> 附加的时刻<sys/> 矢量I/O操作POSIX标准概念的可选头文件(8项)<> 异步I/O <> 消息队列<> 线程<> 执行调度<> 信号量<> 实时spawn接口<> XSI STREAMS接口<> 时刻跟踪标准C++ 语言头文件(54个其中16个用于构建STL,3个为附加非必需)<algorithm> STL通用算法<bitset> STL位集容器<cassert> 用于在程序运行时执行断言<cctype> 字符处置<cerrno> 错误码<cfloat> 用于测试浮点类型属性<ciso646> ISO646变体字符集<climits> 测试整数类型属性<clocale> 本地化函数<cmath> 数学函数<complex> 复数类<csetjmp> 执行非内部的goto语句<csignal> 信号<cstdarg> 访问参数数量转变的函数<cstddef> 用于定义实用的类型和宏<cstdio> 输入/输出<cstdlib> 杂项函数及内存分派<cstring> 字符串<ctime> 时刻<cwchar> 宽字符处置及输入/输出<cwctype> 宽字符分类<deque> STL双端队列容器<exception> 异样处置类<fstream> 文件流<functional> STL函数对象<iomanip> 参数化输入/输出<ios> 大体输入/输出支持<iosfwd> 输入/输出前置声明<iostream> 数据流输入/输出<istream> 大体输入流<iterator> 遍历序列的类<limits> 各类数据类型最值常量<list> STL线性列表容器<locale> 国际化支持<map> STL映射容器<memory> 专用内存分派器<new> 大体内存分派和释放<numeric> 通用的数字操作<ostream> 大体输出流<queue> STL 队列容器<set> STL 集合容器<sstream> 基于字符串的流<stack> STL 堆栈容器<stdexcept> 标准异样类<streambuf> iostream 的缓冲区类<string> 字符串类<strstream> 非内存字符序列的流类<typeinfo> 运行时类型标识<utility> STL 通用模板类<valarray> 支持值数组的类和模版类<vector> STL 动态数组容器标准C++附加的头文件(3个)非必需<hash_map> <hash_set> <slist>The Standard C++ library consists of 51 required implementation also includes three additional headers,<hash_map>,<hash_set>,and <slist>,not required by the C++ Standard, for a total of 54 these 54 headers,16 constitute the Standard Template Library, or are indicated below with the notation<algorithm> -- (STL) for defining numerous templates that implement useful algorithms<bitset> -- for defining a template class that administers sets of bits<complex> -- for defining a template class that supports complex arithmetic<deque> -- (STL) for defining a template class that implements a deque container<exception> -- for defining several functions that control exception handling<fstream> -- for defining several iostreams template classes that manipulate exteral files<functional> -- (STL) for defining several templates that help construct predicates forthe templates defined in <algorithm> and <numeric><hash_map>-- (STL) for defining template classes that implement hashed associative containersthat map keys to values<hash_set>-- (STL) for defining template classes that implement hashed associative containers<iomanip> -- for declaring several iostreams manipulators that take an argument<ios> -- for defining the template class that serves as the base for many iostreams classes<iosfwd> -- for declaring several iostreams template classes before they are necessarilydefined<iostream> -- for declaring the iostreams objects that manipulate the standard streams<istream> -- for defining the template class that performs extractions<iterator>-- (STL) for defining several templates that help define and manipulate iterators<limits> -- for testing numeric type properties<list>-- (STL) for defining a template class that implements a doubly linked list container<locale> -- for defining several classes and templates that controllocale-specific behavior, as in the iostreams classes<map>-- (STL) for defining template classes that implement associative containers thatmap keys to values<memory>-- (STL) for defining several templates that allocate and free storage for variouscontainer classes<new> -- for declaring several functions that allocate and free storage<numeric>-- (STL) for defining several templates that implement useful numeric functions<ostream> -- for defining the template class that performs insertions<queue> -- (STL) for defining a template class that implements a queue container<set>-- (STL) for defining template classes that implement associative containers<slist>-- (STL) for defining a template class that implements a singly linked list container<sstream> -- for defining several iostreams template classes that manipulate string containers <stack> -- (STL) for defining a template class that implements a stack container<stdexcept> -- for defining several classes useful for reporting exceptions<streambuf> -- for defining template classes that buffer iostreams operations<string> -- for defining a template class that implements a string container<strstream> -- for defining several iostreams classes that manipulate in-memory character sequences<typeinfo> -- for defining class type_info, the result of the typeid operator<utility>-- (STL) for defining several templates of general utility<valarray> -- for defining several classes and template classes that support value-oriented arrays<vector>-- (STL) for defining a template class that implements a vector container新的C标准库<cassert> -- for enforcing assertions when functions execute<cctype> -- for classifying characters<cerrno> -- for testing error codes reported by library functions<cfloat> -- for testing floating-point type properties<ciso646> -- for programming in ISO 646 variant character sets<climits> -- for testing integer type properties<clocale> -- for adapting to different cultural conventions<cmath> -- for computing common mathematical functions<csetjmp> -- for executing nonlocal goto statements<csignal> -- for controlling various exceptional conditions<cstdarg> -- for accessing a varying number of arguments<cstddef> -- for defining several useful types and macros<cstdio> -- for performing input and output<cstdlib> -- for performing a variety of operations<cstring> -- for manipulating several kinds of strings<ctime> -- for converting between various time and date formats<cwchar> -- for manipulating wide streams and several kinds of strings<cwctype> -- for classifying wide characters旧的C标准库<> -- for enforcing assertions when functions execute<> -- for classifying characters<> -- for testing error codes reported by library functions<> -- for testing floating-point type properties<> -- for programming in ISO 646 variant character sets<> -- for testing integer type properties<> -- for adapting to different cultural conventions<> -- for computing common mathematical functions<> -- for executing nonlocal goto statements<> -- for controlling various exceptional conditions<> -- for accessing a varying number of arguments<> -- for defining several useful types and macros<> -- for performing input and output<> -- for performing a variety of operations<> -- for manipulating several kinds of strings<> -- for converting between various time and date formats<> -- for manipulating wide streams and several kinds of strings<> -- for classifying wide charactersFinally, in this implementation, the Standard C++ library also includes several headers for compatibility with traditional C++ libraries:<> -- for defining several iostreams template classes that manipulate exteral files<> -- for declaring several iostreams manipulators that take an argument<> -- for declaring the iostreams objects that manipulate the standard streams<> -- for declaring several functions that allocate and free storage<> -- for declaring several template classes that aid migration from older versionsof the Standard Template Library。
我发现网络上转载很多的《C/C++头文件一览》似乎不是很完整,所以做了一下较为完整的整理,加上了头文件的简单介绍,希望对大家有用。
什么是头文件呢?C语言和C++的头文件有什么不一样呢?头文件(header files)又称作预编译文件,是用户应用程序和函数库之间的桥梁和纽带。
作为一种包含功能函数、数据接口声明的载体文件,用于保存程序的声明,而定义文件用于保存程序的实现。
头文件的主要作用在于调用库功能,对各个被调用函数给出一个描述,其本身不包含程序的逻辑实现代码,它只起描述性作用,告诉应用程序通过相应途径寻找相应功能函数的真正逻辑实现代码。
用户程序只需要按照头文件中的接口声明来调用库功能,编译器会从库中提取相应的代码。
简单的说,头文件就是作者告诉程序从哪调用库函数的文件。
头文件一般包括三个部分的内容:(1)版权和版本声明;(2)预处理块;(3)函数和类结构声明。
而具体的结构可以试着打开一个现有的头文件看看。
在标准C++中很多头文件都曾以“加.h”的方式在各种编译器中出现过,现在标准中规定的C++头文件都是没有“.h”后缀的。
传统头文件(除输入输出外),文件名(<*.h>)前加上c (<c*>),就是相应的标准头了,其功能相同。
而像string.h 与 string、limits.h 与 limits、locale.h 与locale这样的,功能却不完全相同。
C语言头文件中定义了一些宏,这些宏在C++中仍然可以使用,但宏是不会隶属于任何命名空间的,使用进要分清标识符和宏。
比如我们可以用std::time,但不能用std::assert,应该直接用assert。
C/C++头文件一览C#include <assert.h> //设定插入点#include <ctype.h> //字符处理#include <errno.h> //定义错误码#include <float.h> //浮点数处理#include <iso646.h> //对应各种运算符的宏#include <limits.h> //定义各种数据类型最值的常量#include <locale.h> //定义本地化C函数#include <math.h> //定义数学函数#include <setjmp.h> //异常处理支持#include <signal.h> //信号机制支持#include <stdarg.h> //不定参数列表支持#include <stddef.h> //常用常量#include <stdio.h> //定义输入/输出函数#include <stdlib.h> //定义杂项函数及内存分配函数#include <string.h> //字符串处理#include <time.h> //定义关于时间的函数#include <wchar.h> //宽字符处理及输入/输出#include <wctype.h> //宽字符分类传统C++#include <fstream.h> //改用<fstream>#include <iomanip.h> //改用<iomainip>#include <iostream.h> //改用<iostream>#include <strstrea.h> //该类不再支持,改用<sstream>中的stringstream————————————————————————————————标准C++#include <algorithm> //STL 通用算法#include <bitset> //STL 位集容器#include <cctype> //字符处理#include <cerrno> //定义错误码#include <cfloat> //浮点数处理#include <ciso646> //对应各种运算符的宏#include <climits> //定义各种数据类型最值的常量#include <clocale> //定义本地化函数#include <cmath> //定义数学函数#include <complex> //复数类#include <csignal> //信号机制支持#include <csetjmp> //异常处理支持#include <cstdarg> //不定参数列表支持#include <cstddef> //常用常量#include <cstdio> //定义输入/输出函数#include <cstdlib> //定义杂项函数及内存分配函数#include <cstring> //字符串处理#include <ctime> //定义关于时间的函数#include <cwchar> //宽字符处理及输入/输出#include <cwctype> //宽字符分类#include <deque> //STL 双端队列容器#include <exception> //异常处理类#include <fstream> //文件输入/输出#include <functional> //STL 定义运算函数(代替运算符)#include <limits> //定义各种数据类型最值常量#include <list> //STL 线性列表容器#include <locale> //本地化特定信息#include <map> //STL 映射容器#include <memory> //STL通过分配器进行的内存分配#include <new> //动态内存分配#include <numeric> //STL常用的数字操作#include <iomanip> //参数化输入/输出#include <ios> //基本输入/输出支持#include <iosfwd> //输入/输出系统使用的前置声明#include <iostream> //数据流输入/输出#include <istream> //基本输入流#include <iterator> //STL迭代器#include <ostream> //基本输出流#include <queue> //STL 队列容器#include <set> //STL 集合容器#include <sstream> //基于字符串的流#include <stack> //STL 堆栈容器#include <stdexcept> //标准异常类#include <streambuf> //底层输入/输出支持#include <string> //字符串类#include <typeinfo> //运行期间类型信息#include <utility> //STL 通用模板类#include <valarray> //对包含值的数组的操作#include <vector> //STL 动态数组容器————————————————————————————————C99增加的部分#include <complex.h> //复数处理#include <fenv.h> //浮点环境#include <inttypes.h> //整数格式转换#include <stdbool.h> //布尔环境#include <stdint.h> //整型环境#include <tgmath.h> //通用类型数学宏。
补充资料TC2.0屏幕定位及彩色输出库函数介绍一、概述为了增加程序的趣味性,必须学会更加多样的输出数据的手段。
下面我们将介绍如何在屏幕的特定位置上输出数据以及如何用彩色字符输出数据。
默认情况下,MS-DOS操作系统工作在文本状态下。
在这种状态下,系统统场将整个屏幕分成25行80列。
也就是说,整个屏幕最多可以容纳25行文本,没行文本最多可以容纳80个字符。
屏幕能容纳的文本的行列数称为文本状态屏幕的分辨率。
80×25的屏幕分辨率可以允许文本具有16种前景色和8种背景色,并且文本可以闪烁。
程序在输出数据时,数据在屏幕上显示的位置就是光标的当前位置(文本状态下,通常总有个光标在闪烁)。
改变了光标的当前位置,也就改变了数据输出的位置。
当在某一行的最后一列输出数据时,光标会自动移到下一行。
当在屏幕最后一行输出数据并超过一行时,屏幕会向上翻滚一行,光标仍停留在最后一行。
我们以前所学习的printf函数九是在光标的当前位置上输出数据,它本身不能控制光标的位置,也不会用彩色文本输出数据。
如果程序员想在屏幕的特定位置采用特定颜色显示数据,就必须学会下面这些函数的使用,见下表。
函数名函数的功能需包含的.h文件textmode 将屏幕设置成文本模式conio.hclrscr 清屏conio.hclreol 清除一行conio.hgotoxy 将光标移动到特定的位置上conio.h textcolor 设置下一次输出数据时文本的前景色conio.h textbackground设置下一次输出数据时文本的背景色conio.hcprintf 同printf的功能一样,只不过输出数据的文本具有最近一次textcolor、textbackground函数调用所设置的文本的前景色和背景色conio.h1. textmode函数原型:void textmode(int newmode);void表示空类型,说明该函数没有返回值;该函数带有一个int型参数。
C语言这些常用的标准库(头文件),你不得不知道...有很多工程师喜欢自己封装一些标准库已有的函数,其实自己封装的函数,并不一定比标准库好,有时候反而代码更冗余,且有bug。
下面小编就来分享一下C语言常见的一些标准库。
标准头文件包括:<asset.h><ctype.h><errno.h><float.h><limits.h><locale.h><math.h><stdio.h><signal.h><time.h><stddef.h><stdlib.h><string.h><stdarg.h><setjmp.h>一、标准定义(<stddef.h>)文件<stddef.h>里包含了标准库的一些常用定义,无论我们包含哪个标准头文件,<stddef.h>都会被自动包含进来。
这个文件里定义:● 类型size_t(sizeof运算符的结果类型,是某个无符号整型);● 类型ptrdiff_t(两个指针相减运算的结果类型,是某个有符号整型);● 类型wchar_t(宽字符类型,是一个整型,其中足以存放本系统所支持的所有本地环境中的字符集的所有编码值。
这里还保证空字符的编码值为0);● 符号常量NULL(空指针值);● 宏offsetot (这是一个带参数的宏,第一个参数应是一个结构类型,第二个参数应是结构成员名。
offsetot(s,m)求出成员m在结构类型t的变量里的偏移量)。
注:其中有些定义也出现在其他头文件里(如NULL)。
二、错误信息(<errno.h>)<errno.h>定义了一个int类型的表达式errno,可以看作一个变量,其初始值为0,一些标准库函数执行中出错时将它设为非0值,但任何标准库函数都设置它为0。
实验使用的是TC 2.0(不带虚拟机),只能在32位系统上运行。
配置使用大概如下:1.把TC2.0放到某个磁盘的根目录下(为了以后不作死):按照实验要求,需要把实验过程中产生的文件都放到指定的文件夹,文件夹名为自己的名字的首字母加下划线加C(如:李凯明,文件夹名应为lkm_c)。
最好把这个文件夹也放在根目录下。
2.配置TC:刚解压的TC包含上一次使用的配置文件,需要重新配置以免出错。
运行TC:按下组合键Alt+O:按D选择配置Directories。
Include directories填写头文件所在文件夹完整路径,此路径错误会导致编译时头文件缺失Library directories填写库文件所在文件夹完整路径,此路径错误会导致你引用库文件时编译器报错Turbo C directories填写你的TC(编译器)所在的文件夹完整路径(这个配置错误会怎么样自己尝试)Output directories输出文件夹,填写你的工作文件夹完整路径(lkm_c),如果此路径不正确会导致找不到生成的exe文件改好路径以后按Esc返回上一级菜单,按S键,然后按Y保存:以上完成的对TC的配置是一次性的,下次使用不需再配置。
每次启动都需要更改工作目录路径:启动TC,按下组合键Alt+f,按C:将路径改成自己的工作文件夹的完整路径,按Enter保存。
编写简单程序进行测试:Include<stdio.h>Void main(){printf(“Hello C\n”);}F2:(快捷键)保存F9:编译组合键Ctrl+F9:运行组合键Alt+F5:查看运行结果如果编译运行均没有错误,说明配置没有错误,打开你的工作目录,应该有四个文件(.c,.bak,.obj,.exe).c:源文件,用记事本可以打开.bak:备份文件,当源文件发生改变时产生,保存的是源文件修改之前的代码.obj:目标文件,编译时用产生,用以连接其他文件.exe:二进制冻结文件,可以直接运行的程序如果缺少.c和.bak,Output文件夹配置错误如果缺少.obj和.exe,运行TC时没有配置工作目录或者配置错误There’s two way to show the teacher your work : OS Shell or cmd.OS Shell我用的比较少,并且只能全屏,不介绍了下面介绍CMD:在windows系统中通过组合键windows+r 可以唤出如下菜单:输入cmd,确定注意红框内的指令,干什么用的自己研究以上内容根据本人记忆完成,错误之处欢迎指出。
TC2.0 菜单详解一览(1)File (文件)菜单。
按Alt+F可进入File菜单,该菜单包括以下内容:.Load (加载)装入一个文件,可用类似DOS的通配符(如*.C)来进行列表选择。
也可装入其它扩展名的文件,只要给出文件名(或只给路径)即可。
该项的热键为F3,即只要在主菜单中按F3即可进入该项,而不需要先进入File菜单再选此项。
.Pick (选择)将最近装入编辑窗口的8个文件列成一个表让用户选择,选择后将该程序装入编辑区,并将光标置在上次修改过的地方。
其热健为Alt-F3。
.New (新文件)说明文件是新的,缺省文件名为NONAME.C,存盘时可改名。
.Save (存盘)将编辑区中的文件存盘,若文件名是NONAME.C时,将询问是否更改文件名,其热键为F2。
.Write to (存盘)可由用户给出文件名将编辑区中的文件存盘,若该文件已存在,则询问要不要覆盖。
.Directory (目录)显示目录及目录中的文件,并可由用户选择。
.Change dir (改变目录)显示当前目录,用户可以改变显示的目录。
.Os shell (暂时退出)暂时退出Turbo C 2.0到DOS提示符下,此时可以运行DOS 命令,若想回到Turbo C 2.0中,只要在DOS状态下键入EXIT即可。
.Quit (退出)退出Turbo C 2.0,返回到DOS操作系统中,其热键为Alt+X。
说明:以上各项可用光标键移动色棒进行选择,回车则执行。
也可用每一项的第一个大写字母直接选择。
若要退到主菜单或从它的下一级菜单列表框退回均可用Esc键,Turbo C 2.0所有菜单均采用这种方法进行操作,以下不再说明。
(2)Edit (编辑)菜单。
按Alt+E可进入编辑菜单,若再回车,则光标出现在编辑窗口,此时用户可以进行文本编辑。
编辑方法基本与wordstar相同,可用F1键获得有关编辑方法的帮助信息。
与编辑有关的功能键如下:F1 获得Turbo C 2.0编辑命令的帮助信息F5 扩大编辑窗口到整个屏幕F6 在编辑窗口与信息窗口之间进行切换F10 从编辑窗口转到主菜单编辑命令简介:PageUp 向前翻页PageDn 向后翻页Home 将光标移到所在行的开始End 将光标移到所在行的结尾Ctrl+Y删除光标所在的一行Ctrl+T 删除光标所在处的一个词Ctrl+KB 设置块开始Ctrl+KK 设置块结尾Ctrl+KV 块移动Ctrl+KC 块拷贝Ctrl+KY块删除Ctrl+KR 读文件Ctrl+KW 存文件Ctrl+KP 块文件打印Ctrl+F1 如果光标所在处为Turbo C 2.0库函数,则获得有关该函数的帮助信息Ctrl+Q[ 查找Turbo C 2.0双界符的后匹配符Ctrl+Q] 查找Turbo C 2.0双界符的前匹配符说明:a. Turbo C 2.0的双界符包括以下几种符号:花括符 { }尖括符 < >圆括符()方括符 [ ]注释符 /* */双引号 "单引号 ''b. Turbo C 2.0在编辑文件时还有一种功能,就是能够自动缩进,即光标定位和上一个非空字符对齐。
分类函数,所在函数库为ctype.hint isalpha(int ch) 若ch是字母('A'-'Z','a'-'z')返回非0值,否则返回0 int isalnum(int ch) 若ch是字母('A'-'Z','a'-'z')或数字('0'-'9')返回非0值,否则返回0int isascii(int ch) 若ch是字符(ASCII码中的0-127)返回非0值,否则返回0int iscntrl(int ch) 若ch是作废字符(0x7F)或普通控制字符(0x00-0x1F)返回非0值,否则返回0int isdigit(int ch) 若ch是数字('0'-'9')返回非0值,否则返回0int isgraph(int ch) 若ch是可打印字符(不含空格)(0x21-0x7E)返回非0值,否则返回0int islower(int ch) 若ch是小写字母('a'-'z')返回非0值,否则返回0int isprint(int ch) 若ch是可打印字符(含空格)(0x20-0x7E)返回非0值,否则返回0int ispunct(int ch) 若ch是标点字符(0x00-0x1F)返回非0值,否则返回0 int isspace(int ch) 若ch是空格(' '),水平制表符('\t'),回车符('\r'),走纸换行('\f'),垂直制表符('\v'),换行符('\n')返回非0值,否则返回0int isupper(int ch) 若ch是大写字母('A'-'Z')返回非0值,否则返回0int isxdigit(int ch) 若ch是16进制数('0'-'9','A'-'F','a'-'f')返回非0值,否则返回0int tolower(int ch) 若ch是大写字母('A'-'Z')返回相应的小写字母('a'-'z')int toupper(int ch) 若ch是小写字母('a'-'z')返回相应的大写字母('A'-'Z')数学函数,所在函数库为math.h、stdlib.h、string.h、float.hint abs(int i) 返回整型参数i的绝对值double cabs(struct complex znum) 返回复数znum的绝对值double fabs(double x) 返回双精度参数x的绝对值long labs(long n) 返回长整型参数n的绝对值double exp(double x) 返回指数函数ex的值double frexp(double value,int *eptr) 返回value=x*2n中x的值,n存贮在eptr中double ldexp(double value,int exp); 返回value*2exp的值double log(double x) 返回logex的值double log10(double x) 返回log10x的值double pow(double x,double y) 返回xy的值double pow10(int p) 返回10p的值double sqrt(double x) 返回+√x的值double acos(double x) 返回x的反余弦cos-1(x)值,x为弧度double asin(double x) 返回x的反正弦sin-1(x)值,x为弧度double atan(double x) 返回x的反正切tan-1(x)值,x为弧度double atan2(double y,double x) 返回y/x的反正切tan-1(x)值,y 的x为弧度double cos(double x) 返回x的余弦cos(x)值,x为弧度double sin(double x) 返回x的正弦sin(x)值,x为弧度double tan(double x) 返回x的正切tan(x)值,x为弧度double cosh(double x) 返回x的双曲余弦cosh(x)值,x为弧度double sinh(double x) 返回x的双曲正弦sinh(x)值,x为弧度double tanh(double x) 返回x的双曲正切tanh(x)值,x为弧度double hypot(double x,double y) 返回直角三角形斜边的长度(z), x和y为直角边的长度,z2=x2+y2 double ceil(double x) 返回不小于x的最小整数double floor(double x) 返回不大于x的最大整数void srand(unsigned seed) 初始化随机数发生器int rand() 产生一个随机数并返回这个数double poly(double x,int n,double c[])从参数产生一个多项式double modf(double value,double *iptr)将双精度数value分解成尾数和阶double fmod(double x,double y) 返回x/y的余数double frexp(double value,int *eptr) 将双精度数value分成尾数和阶double atof(char *nptr) 将字符串nptr转换成浮点数并返回这个浮点数double atoi(char *nptr) 将字符串nptr转换成整数并返回这个整数double atol(char *nptr) 将字符串nptr转换成长整数并返回这个整数char *ecvt(double value,int ndigit,int *decpt,int *sign)将浮点数value转换成字符串并返回该字符串char *fcvt(double value,int ndigit,int *decpt,int *sign)将浮点数value转换成字符串并返回该字符串char *gcvt(double value,int ndigit,char *buf)将数value转换成字符串并存于buf中,并返回buf的指针char *ultoa(unsigned long value,char *string,int radix)将无符号整型数value转换成字符串并返回该字符串,radix为转换时所用基数char *ltoa(long value,char *string,int radix)将长整型数value转换成字符串并返回该字符串,radix为转换时所用基数char *itoa(int value,char *string,int radix)将整数value转换成字符串存入string,radix为转换时所用基数double atof(char *nptr) 将字符串nptr转换成双精度数,并返回这个数,错误返回0int atoi(char *nptr) 将字符串nptr转换成整型数, 并返回这个数,错误返回0long atol(char *nptr) 将字符串nptr转换成长整型数,并返回这个数,错误返回0double strtod(char *str,char **endptr)将字符串str转换成双精度数,并返回这个数,long strtol(char *str,char **endptr,int base)将字符串str转换成长整型数,并返回这个数,int matherr(struct exception *e)用户修改数学错误返回信息函数(没有必要使用)double _matherr(_mexcep why,char *fun,double *arg1p,double *arg2p,double retval)用户修改数学错误返回信息函数(没有必要使用)unsigned int _clear87() 清除浮点状态字并返回原来的浮点状态void _fpreset() 重新初使化浮点数学程序包unsigned int _status87() 返回浮点状态字目录函数,所在函数库为dir.h、dos.hint chdir(char *path) 使指定的目录path(如:"C:\\WPS")变成当前的工作目录,成功返回0int findfirst(char *pathname,struct ffblk *ffblk,int attrib)查找指定的文件,成功返回0pathname为指定的目录名和文件名,如"C:\\WPS\\TXT"ffblk为指定的保存文件信息的一个结构,定义如下:┏━━━━━━━━━━━━━━━━━━┓┃struct ffblk ┃┃{ ┃┃ char ff_reserved[21]; /*DOS保留字*/┃┃ cha r ff_attrib; /*文件属性*/ ┃┃ int ff_ftime; /*文件时间*/ ┃┃ int ff_fdate; /*文件日期*/ ┃┃ long ff_fsize; /*文件长度*/ ┃┃ char ff_name[13]; /*文件名*/ ┃┃} ┃┗━━━━━━━━━━━━━━━━━━┛attrib为文件属性,由以下字符代表┏━━━━━━━━━┳━━━━━━━━┓┃FA_RDONLY 只读文件┃FA_LABEL 卷标号┃┃FA_HIDDEN 隐藏文件┃FA_DIREC 目录┃┃FA_SYSTEM 系统文件┃FA_ARCH 档案┃┗━━━━━━━━━┻━━━━━━━━┛例:struct ffblk ff;findfirst("*.wps",&ff,FA_RDONLY);int findnext(struct ffblk *ffblk) 取匹配finddirst的文件,成功返回0void fumerge(char *path,char *drive,char *dir,char *name,char *ext) 此函数通过盘符drive(C:、A:等),路径dir(\TC、\BC\LIB等),文件名name(TC、WPS等),扩展名ext(.EXE、.COM等)组成一个文件名存与path中.int fnsplit(char *path,char *drive,char *dir,char *name,char *ext) 此函数将文件名path分解成盘符drive(C:、A:等),路径dir(\TC、\BC\LIB等),文件名name(TC、WPS等),扩展名ext(.EXE、.COM等),并分别存入相应的变量中.int getcurdir(int drive,char *direc) 此函数返回指定驱动器的当前工作目录名称drive 指定的驱动器(0=当前,1=A,2=B,3=C等)direc 保存指定驱动器当前工作路径的变量成功返回0char *getcwd(char *buf,iint n) 此函数取当前工作目录并存入buf中,直到n 个字节长为为止.错误返回NULLint getdisk() 取当前正在使用的驱动器,返回一个整数(0=A,1=B,2=C等) int setdisk(int drive) 设置要使用的驱动器drive(0=A,1=B,2=C等), 返回可使用驱动器总数int mkdir(char *pathname) 建立一个新的目录pathname,成功返回0int rmdir(char *pathname) 删除一个目录pathname,成功返回0char *mktemp(char *template) 构造一个当前目录上没有的文件名并存于template中char *searchpath(char *pathname) 利用MSDOS找出文件filename所在路径, ,此函数使用DOS的PATH变量,未找到文件返回NULL进程函数,所在函数库为stdlib.h、process.hvoid abort() 此函数通过调用具有出口代码3的_exit写一个终止信息于stderr,并异常终止程序。