28 #if defined ( MSDOS ) || defined ( WIN32 )
29 #include <sys/types.h>
40 #if defined ( _MSC_VER ) && _MSC_VER >= 1400
42 #define mktemp _mktemp
44 #define fdopen _fdopen
59 if ( size == 0 || nmemb == 0 )
65 fwrite( buf, size, nmemb, stream );
67 if ( ferror( stream ) )
72 plabort(
"Error writing to file" );
91 if ( size == 0 || nmemb == 0 )
93 plwarn(
"Zero length buffer size in plio_fread, returning" );
100 bytes = fread( buf, size, nmemb, stream );
102 if ( ( bytes < nmemb ) && ferror( stream ) )
105 plabort(
"Error reading from file" );
137 plwarn(
"Zero length buffer size in plio_fgets, returning" );
144 s = fgets( buf, size, stream );
146 if ( s == NULL && ferror( stream ) )
149 plabort(
"Error reading from file" );
176 const char *tmpname =
"plplot_XXXXXX";
177 #if !defined PL_HAVE_MKSTEMP
181 #if defined ( MSDOS ) || defined ( WIN32 )
182 tmpdir = getenv(
"TEMP" );
184 tmpdir = getenv(
"TMPDIR" );
189 if ( tmpdir == NULL )
193 if ( tmpdir == NULL )
195 #if defined ( MSDOS ) || defined ( WIN32 )
196 tmpdir =
"c:\\windows\\Temp";
203 template = (
char *) malloc(
sizeof (
char ) * ( strlen( tmpdir ) + strlen( tmpname ) + 2 ) );
204 strcpy(
template, tmpdir );
205 #if defined ( MSDOS ) || defined ( WIN32 )
206 strcat(
template,
"\\" );
208 strcat(
template,
"/" );
210 strcat(
template, tmpname );
212 #ifdef PL_HAVE_MKSTEMP
213 fd = fdopen( mkstemp(
template ),
"wb+" );
216 plwarn(
"pl_create_tempfile: Unable to open temporary file - returning" );
224 #ifdef PL_HAVE_UNLINK
229 #if !defined ( _S_IREAD )
232 #if !defined ( _S_IWRITE )
233 #define _S_IWRITE 128
236 flags = O_RDWR | O_BINARY | O_CREAT | O_EXCL | _O_SHORT_LIVED;
240 flags = flags | _O_TEMPORARY;