stdlib.h 找不到和cstdlib的区别

#include&cstdlib&这个头文件是干嘛的??_百度知道stdlib.h和cstdlib的区别_百度知道求#include<stdlib.h>与#include<cstdlib_生活百科_百科问答
求#include<stdlib.h>与#include<cstdlib
提问者:康国轩
#include &iostream.h&它相当于#include&iostream& #include&stdlib.h& :.h是 老的,非模版化的版本#include&cstdlib& : 新的,模版化的版本[gsone@h02-vm16 3.4.6]$ cat cstdlib // -*- C++ -*- forwarding header.// Copyright (C) , , , 2003// Free Software Foundation, Inc.//// This file is part of the GNU ISO C++ Library. This library is free// you can redistribute it and/or modify it under the// terms of the GNU General Public License as published by the// Free Software F either version 2, or (at your option)// any later version.// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.// You should have received a copy of the GNU General Public License along// see the file COPYING. If not, write to the Free// Software Foundation, 59 Temple Place - Suite 330, Boston, MA ,// USA.// As a special exception, you may use this file as part of a free software// library without restriction. Specifically, if other files instantiate// templates or use macros or inline functions from this file, or you compile// this file and link it with other files to produce an executable, this// file does not by itself cause the resulting executable to be covered by// the GNU General Public License. This exception does not however// invalidate any other reasons why the executable file might be covered by// the GNU General Public License.//// ISO C++ 1.6 C library///** @file cstdlib* This is a Standard C++ Library file. You should @c #include this file* in your programs, rather than any of the &*.h& implementation files.** This is the C++ version of the Standard C Library header @c stdlib.h,* and its contents are (mostly) the same as that header, but are all* contained in the namespace @c std.*/#ifndef _GLIBCXX_CSTDLIB#define _GLIBCXX_CSTDLIB 1#pragma GCC system_header#include &bits/c++config.h&#include &cstddef&#include &stdlib.h&// Get rid of those macros defined in &stdlib.h& in lieu of real functions.#undef abort#undef abs#undef atexit#undef atof#undef atoi#undef atol#undef bsearch#undef calloc#undef div#undef exit#undef free#undef getenv#undef labs#undef ldiv#undef malloc#undef mblen#undef mbstowcs#undef mbtowc#undef qsort#undef rand#undef realloc#undef srand#undef strtod#undef strtol#undef strtoul#undef system#undef wcstombs#undef wctombnamespace std{using ::div_t;using ::ldiv_t;using ::using ::using ::using ::using ::using ::using ::using ::using ::using ::using ::using ::using ::using ::using ::#ifdef _GLIBCXX_HAVE_MBSTATE_Tusing ::using ::using ::#endif // _GLIBCXX_HAVE_MBSTATE_Tusing ::using ::using ::using ::using ::using ::using ::using ::#ifdef _GLIBCXX_USE_WCHAR_Tusing ::using ::#endif // _GLIBCXX_USE_WCHAR_Tinline longabs(long __i) { return labs(__i); }inline ldiv_tdiv(long __i, long __j) { return ldiv(__i, __j); }}#if _GLIBCXX_USE_C99#undef _Exit#undef llabs#undef lldiv#undef atoll#undef strtoll#undef strtoull#undef strtof#undef strtoldnamespace __gnu_cxx{#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMICusing ::lldiv_t;#endif#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMICextern &C& void (_Exit)(int);#endif#if !_GLIBCXX_USE_C99_DYNAMICusing ::_E#endifinline long longabs(long long __x) { return __x &= 0 ? __x : -__x; }inline long longllabs(long long __x) { return __x &= 0 ? __x : -__x; }#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMICinline lldiv_tdiv(long long __n, long long __d){ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }inline lldiv_tlldiv(long long __n, long long __d){ lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }#endif#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMICextern &C& long long int (atoll)(const char *);extern &C& long long int (strtoll)(const char * restrict, char ** restrict, int);extern &C& unsigned long long int (strtoull)(const char * restrict, char ** restrict, int);#endif#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMICusing ::using ::using ::#endifusing ::using ::}namespace std{#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMICusing __gnu_cxx::lldiv_t;#endifusing __gnu_cxx::_Eusing __gnu_cxx::using __gnu_cxx::#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMICusing __gnu_cxx::using __gnu_cxx::#endifusing __gnu_cxx::using __gnu_cxx::using __gnu_cxx::using __gnu_cxx::using __gnu_cxx::}#endif#endif
回答者:孔田森
Mail: Copyright by ;All rights reserved.#include&cstdlib&用法_百度知道C/C++中stdlib.h/cstdlib头文件下的库函数
C/C++中stdlib.h/cstdlib头文件下的库函数&&
在C++里Include C的头文件,就需要在原来的.h文件前加个c,并去掉.h;c++头文件include
&cstdlib&对应c中的include
&stdlib.h&头文件
===================================================
atof()将字符串转换成浮点数的函数&
原形:double atof(const char *s)&
功能:把s所指向的字符串转换成double类型。&
   s格式为:符号 数字.数字 E符号 数字&
返回值:字符串的转换值。&
头文件:math.h、stdlib.h&
atoi()将字符串转换成整型数的函数&
原形:int atoi(const char *s)&
功能:把s所指向的字符串转换成int类型。&
   s格式为:符号 数字&
返回值:字符串的转换值。若出错则返回0。&
头文件:stdlib.h&
atol()将字符串转换成长整型数的函数&
原形:long atol(const char *s)&
功能:把s所指向的字符串转换成long int类型。&
   s格式为:符号 数字&
返回值:字符串的转换值。若出错则返回0。&
头文件:stdlib.h&
===================================================&
calloc()分配内存函数&
原形:void *calloc(size_t nitems,size_t
功能:在堆中分配一块内存,将该内存的内容全部清0。&
返回值:返回指向新分配内存的指针。空间不够则返回NULL。&
头文件:stdlib.h、calloc.h&
===================================================&
free()释放已分配内存的函数&
原形:void free(void *block)&
功能:释放由calloc、malloc、realloc函数调用所分配的内存。&
头文件:stdlib.h、alloc.h&
====================================================&
gcvt()把双精度数转化成字符串的函数&
原形∶char*gcvt(value,ndigit,buf)&
  其中∶double value是待转化数&
     int ndigit是转化长度&
     char *buf保存转化后的地址&
头文件∶stdlib.h&
====================================================&
geninterrupt()执行中断函数&
原形:void geninterrupt(int n)&
调用方式:geninterrupt(软中断号)&
功能:产生一个8086软中断&
注:需先向寄存器传递入口信息(用伪变量)&
  例如  伪变量=要赋的值(入口信息);&
      调用geninterrupt()函数后得接受出口信息&
  例如  变量名=伪变量&
伪变量∶Turbo C
允许使用伪变量直接访问相应的8086寄存器。伪变量的类型有两种。&
  ① unsigned int : _AX、 _BX、 _CX、 _DX、 _CS、 _DS、 _SS、 _ES、_SP、 _BP、
_DI、 _SI&
  ② unsigned char: _AL、 _AH、 _BL、 _BH、 _CL、 _CH、 _DL、
===================================================&
getenv()读取环境变量的当前值的函数&
原形:char *getenv(const char *name)&
用法:s=getenv("环境变量名");&
   需先定义char *s;&
功能:返回一给定的环境变量值,环境变量名可大写或小写。如果指定的变量在环境中未定义,则返回一空串。&
头文件:stdlib.h&
====================================================&
itoa()把整形数转换为字符串的函数&
原形:char *itoa(int value,char *string,int
功能:把value的值转换为以NULL结束的字符串,并把结果存在string中。radix是转换的基数值,在2到36之间。分配给string的空间必须可容纳返回的所有字节(最多17字节)。&
返回值:指向string的指针&
头文件:stdlib.h&
==================================================&
_lrotl()将一个无符号长整形数左循环移位的函数&
原形:unsigned long _lrotl(unsigned long value,int
功能:将value向左循环移动count位。&
返回值:将value向左循环移动count位后的值。&
头文件:stdlib.h&
_lrotr()将一个无符号长整形数右循环移位的函数&
原形:unsigned long _lrotr(unsigned long value,int
功能:将value向右循环移动count位。&
返回值:将value向右循环移动count位后的值。&
头文件:stdlib.h&
ltoa()把长整形数转换为字符串的函数&
原形:char *ltoa(long value,char *string,int
功能:把value的值转换为以NULL结束的字符串,并把结果存在string中。radix是转换的基数值,在2到36之间。分配给string的空间必须可容纳返回的所有字节(最多33字节)。&
返回值:指向string的指针&
头文件:stdlib.h&
malloc()分配内存函数&
原形:void *malloc(size_t size)&
功能:从堆中分配大小为size字节的块。win32也适用。&
返回值:返回新分配内存的地址,若无足够内存,返回NULL。&
头文件:alloc.h、stdlib.h&
============================================================&
putenv()将字符串放入当前环境中的函数&
原形:int putenv(const char *name)&
用法例:putenv("PATH=C:\B\TC");&
功能:把字符串name加到当前程序运行的环境中。当程序结束后,原环境将得到恢复。&
返回值:0(成功);-1(失败)&
头文件:stdlib.h&
============================================================&
realloc()重新分配内存函数&
原形:void *realloc(void *block,size_t
   block指向用malloc、calloc或realloc已得到的内存。&
   size是重新分配的字节。&
返回值:重分配的块地址。若不能重分配,则返回NULL。&
头文件:stdlib.h&
=============================================================&
_rotl()将一个无符号整形数左循环移位的函数&
原形:unsigned _rotl(unsigned value,int
功能:将value向左循环移动count位。&
返回值:将value向左循环移动count位后的值。&
头文件:stdlib.h&
=============================================================&
_rotr()将一个无符号整形数右循环移位的函数&
原形:unsigned _rotr(unsigned value,int
功能:将value向右循环移动count位。&
返回值:将value向右循环移动count位后的值。&
头文件:stdlib.h&
=============================================================
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。}

我要回帖

更多关于 无法打开stdlib.h 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信