diff -r 000000000000 -r e4d67989cc36 genericopenlibs/cstdlib/LSTDIO/TMPFILE.C --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/genericopenlibs/cstdlib/LSTDIO/TMPFILE.C Tue Feb 02 02:01:42 2010 +0200 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* FUNCTION +* <>---create a temporary file +* INDEX +* tmpfile +* INDEX +* _tmpfile_r +* ANSI_SYNOPSIS +* #include +* FILE *tmpfile(void); +* FILE *_tmpfile_r(void *<[reent]>); +* TRAD_SYNOPSIS +* #include +* FILE *tmpfile(); +* FILE *_tmpfile_r(<[reent]>) +* char *<[reent]>; +* Create a temporary file (a file which will be deleted automatically), +* using a name generated by <>. The temporary file is opened with +* the mode <<"wb+">>, permitting you to read and write anywhere in it +* as a binary file (without any data transformations the host system may +* perform for text files). +* The alternate function <<_tmpfile_r>> is a reentrant version. The +* argument <[reent]> is a pointer to a reentrancy structure. +* RETURNS +* <> normally returns a pointer to the temporary file. If no +* temporary file could be created, the result is NULL, and <> +* records the reason for failure. +* PORTABILITY +* Both ANSI C and the System V Interface Definition (Issue 2) require +* <>. +* Supporting OS subroutines required: <>, <>, <>, +* <>, <>, <>, <>, <>, <>. +* <> also requires the global pointer <>. +* +* +*/ + + + +#include + +/** +Open a temporary file. +Creates a temporary binary file for update. +The filename is unique to avoid any conflict with existing files. +@return file pointer (stream) to the temporary file created. +If the file can not be created a NULL pointer is returned. +*/ +EXPORT_C FILE *tmpfile (void) + { + return _tmpfile_r (_REENT); + } + +/** +Open a temporary file. +Creates a temporary binary file for update. +The filename is unique to avoid any conflict with existing files. +@return FILE +*/ +EXPORT_C FILE *_tmpfile_r (struct _reent *r) + { + return _wfopen_r(r, (wchar_t*)L"TMP:", (wchar_t*)L"wb+"); + }