Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
tests
regress
18.limits.stdcxx-436.cpp
Go to the documentation of this file.
1
27
#include <
assert.h
>
// for assert()
28
#include <
limits.h
>
// for MB_LEN_MAX
29
30
// tell Compaq C++ we need the declaration of the POSIX popen() function
31
// that's guarded (not declared) in the compiler's pure C++ libc headers
32
#undef __PURE_CNAME
33
#include <
stdio.h
>
// for popen(), fscanf(), pclose(), ...
34
35
#ifdef _WIN32
36
# define popen _popen
37
# define pclose _pclose
38
#endif
// _WIN32
39
40
int
main
()
41
{
42
// assumes getconf is in the path. on most unix systems it is in
43
// '/usr/bin' and it doesn't exist on most win32 configurations,
44
// yet somehow this appears to work on windows, but not sure how.
45
46
FILE
*
f
=
popen
(
"getconf MB_LEN_MAX"
,
"r"
);
47
if
(
f
) {
48
49
int
mb_len_max = -1;
50
51
const
bool
failed = fscanf (
f
,
"%d"
, &mb_len_max) != 1;
52
53
pclose (
f
);
54
55
// if getconf isn't available, or getconf doesn't know the limit
56
// the scan will fail, so we must handle both situations.
57
assert
(failed ||
MB_LEN_MAX
== mb_len_max);
58
}
59
60
return
0;
61
}
f
#define f
Definition
17.names.cpp:119
main
int main()
Definition
18.limits.stdcxx-436.cpp:40
assert
#define assert(expr)
Definition
_cassert.h:40
FILE
#define FILE
assert.h
limits.h
MB_LEN_MAX
#define MB_LEN_MAX
Definition
limits.h:100
stdio.h
popen
FILE * popen(const char *, const char *)
Generated by
1.9.8