- Forgotten tempfile code.
This commit is contained in:
parent
7c8ca527b2
commit
46636014c0
39
src/tempfile.c
Normal file
39
src/tempfile.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @file tempfile.c
|
||||||
|
*
|
||||||
|
* Generate a temporary file stream
|
||||||
|
*
|
||||||
|
* Before Vista this was trivial, more or less. However Vista restricts access
|
||||||
|
* so much that this call usually breaks, which is a pretty annoying bug.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef FORWINDOWS
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "bool.h"
|
||||||
|
#include "symbol.h"
|
||||||
|
|
||||||
|
//! Create a new temporary file and return the pointer.
|
||||||
|
/**
|
||||||
|
* Before Vista this was trivial, more or less. However Vista restricts access
|
||||||
|
* so much that this call usually breaks, which is a pretty annoying bug.
|
||||||
|
*
|
||||||
|
* http://msdn2.microsoft.com/en-us/library/aa363875.aspx
|
||||||
|
*/
|
||||||
|
FILE *
|
||||||
|
scyther_tempfile (void)
|
||||||
|
{
|
||||||
|
#ifdef FORWINDOWS
|
||||||
|
/* For now, just the broken copy, I'm sorry. */
|
||||||
|
return tmpfile ();
|
||||||
|
#else
|
||||||
|
/* On any other platform the normal stuff just works (tm) */
|
||||||
|
return tmpfile ();
|
||||||
|
#endif
|
||||||
|
}
|
8
src/tempfile.h
Normal file
8
src/tempfile.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef TEMPFILES
|
||||||
|
#define TEMPFILES
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
FILE *scyther_tempfile (void);
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user