Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
rw_file.h
Go to the documentation of this file.
1
29#ifndef RW_FILE_H_INCLUDED
30#define RW_FILE_H_INCLUDED
31
32
33#include <rw_testdefs.h> // for test config macros
34
35
36#ifndef _WIN32
37 // POSIX special files:
38 // http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap10.html
39# define DEV_CONSOLE "/dev/console"
40# define DEV_NULL "/dev/null"
41# define DEV_TTY "/dev/tty"
42#else // if defined (_WIN32)
43# define DEV_CONSOLE "CON:"
44# define DEV_NULL "NUL:"
45# define DEV_TTY "CON:"
46#endif // _WIN32
47
48
49#if _RWSTD_PATH_SEP == '/'
50# define SLASH "/"
51# define SHELL_MV "mv "
52# define SHELL_RM_F "rm -f "
53# define SHELL_RM_RF "rm -rf "
54#else
55# define SLASH "\\"
56# define SHELL_MV "move /Y "
57# define SHELL_RM_F "del /F "
58# define SHELL_RM_RF "rmdir /Q /S "
59#endif
60
61
62// writes chars using symbolic names from the Portable Character Set (PCS)
63// or using the <U00XX> notations for narrow characters outside that set
64// if teh second argument is 0, writes out the CHARMAP section of the locale
65// definition file for the Portable Character Set (in POSIX-compliant format)
66_TEST_EXPORT void
67pcs_write (void*, const char*);
68
69
70// creates a unique temporary file name as if by calling tmpnam()
71// but avoiding various platform-specific quirks (such as HP-UX
72// failure when _REENTRANT is #defined or GNU glibc warnings)
74const char* rw_tmpnam (char*);
75
76// tries to open file named by the first argument and, if successful,
77// allocates a block of storage sufficiently large to hold the file's
78// entire contents, as determined by the stat() function; it then reads
79// the contents of the file into the block of storage, returning a pointer
80// to the block; if the second argument is non-0, sets the pointed-to value
81// to the number of bytes read
82// as a special case, when the first argument is 0 and the second is not,
83// the function takes the third argument as a pointer to the buffer that
84// it will use to read the contents of files into in subsequent calls,
85// provided the buffer is large enough
86_TEST_EXPORT void*
87rw_fread (const char*,
88 _RWSTD_SIZE_T* = 0 /* size in bytes */,
89 const char* = "r" /* stdio open mode */);
90
91// if the second argument is non-0, writes N bytes starting at that
92// location into the file named by the first argument; N is taken
93// from the value pointed to by the third argument, if non-0, or
94// as the result of calling strlen() on the buffer pointed to by
95// the second argument; if the second argument is 0, the function
96// removes the named file; returns the number of bytes written
97_TEST_EXPORT _RWSTD_SIZE_T
98rw_fwrite (const char*,
99 const void*,
100 _RWSTD_SIZE_T = ~0 /* size in bytes */,
101 const char* = "w" /* stdio open mode */ );
102
103
104_TEST_EXPORT int
105rw_nextfd (int*);
106
107#endif // RW_FILE_H_INCLUDED
_TEST_EXPORT void pcs_write(void *, const char *)
Definition file.cpp:89
_TEST_EXPORT const char * rw_tmpnam(char *)
Definition file.cpp:206
_TEST_EXPORT _RWSTD_SIZE_T rw_fwrite(const char *, const void *, _RWSTD_SIZE_T=~0, const char *="w")
_TEST_EXPORT int rw_nextfd(int *)
Definition file.cpp:478
_TEST_EXPORT void * rw_fread(const char *, _RWSTD_SIZE_T *=0, const char *="r")
#define _TEST_EXPORT
Definition rw_testdefs.h:55