www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Random numbers

↑ ↓ ← Monk <Monk_member pathlink.com> writes:
rand() and RAND_MAX don't seem to be available, or are they? What is the
equivalent of cstdlib.h?
Jun 04 2003
↑ ↓ Heinz Saathoff <hsaat bre.ipnet.de> writes:
Monk schrieb...
 rand() and RAND_MAX don't seem to be available, or are they? What is the
 equivalent of cstdlib.h?

You include either <stdlib.h> or <cstdlib>, but not <cstdlib.h> (hope this is true for DM). - Heinz
Jun 05 2003
↑ ↓ "Greg Peet" <admin gregpeet.com> writes:
Prepended header files with 'c' indicate the standardized ruling for using
the C runtime library (standard portions) with C++. Thus time becomes
<ctime> instead of <time.h>, <stdio.h> becomes <cstdio>, <stdlib.h> becomes
<cstdlib>, etc. Are you writing in C or C++? If it's C++, there should be no
.h (though you may sometimes, non-standard-ruled for some). Now if you are,
take into account which Standard Library you are using. I've had some
problems with namespaces with the SGI (which is why STLPort is available).

"Heinz Saathoff" <hsaat bre.ipnet.de> wrote in message
news:MPG.1949550a205d33d29896bd news.digitalmars.com...
 Monk schrieb...
 rand() and RAND_MAX don't seem to be available, or are they? What is the
 equivalent of cstdlib.h?

You include either <stdlib.h> or <cstdlib>, but not <cstdlib.h> (hope this is true for DM). - Heinz

Jun 06 2003
↑ ↓ → Heinz Saathoff <hsaat bre.ipnet.de> writes:
Greg Peet schrieb...
 Prepended header files with 'c' indicate the standardized ruling for using
 the C runtime library (standard portions) with C++. Thus time becomes
 <ctime> instead of <time.h>, <stdio.h> becomes <cstdio>, <stdlib.h> becomes
 <cstdlib>, etc. Are you writing in C or C++? If it's C++, there should be no
 .h (though you may sometimes, non-standard-ruled for some). Now if you are,
 take into account which Standard Library you are using. I've had some
 problems with namespaces with the SGI (which is why STLPort is available).

The difference between <cname> and <name.h> in C++ is that all identifiers (except macros) are in namespace std when <cname> is included and in global namespace if <name.h> is included. For now I still use the 'original' c-headers (old men move slowly <g>). - Heinz
Jun 06 2003