]> pd.if.org Git - pdclib/blob - platform/example_cygwin/functions/stdio/tmpfile.c
Fixed prototype warnings.
[pdclib] / platform / example_cygwin / functions / stdio / tmpfile.c
1 /* $Id$ */
2
3 /* tmpfile( void )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 #include <stdio.h>
10
11 #ifndef REGTEST
12
13 struct _PDCLIB_file_t * tmpfile( void )
14 {
15     /* TODO: Implement */
16     return NULL;
17 }
18
19 #endif
20
21 #ifdef TEST
22 #include <_PDCLIB_test.h>
23
24 int main( void )
25 {
26     FILE * fh;
27     char filename[ L_tmpnam ];
28     FILE * fhtest;
29     TESTCASE( ( fh = tmpfile() ) != NULL );
30     TESTCASE( fputc( 'x', fh ) == 'x' );
31     /* Checking that file is actually there */
32     TESTCASE_NOREG( strcpy( filename, fh->filename ) == filename );
33     TESTCASE_NOREG( ( fhtest = fopen( filename, "r" ) ) != NULL );
34     TESTCASE_NOREG( fclose( fhtest ) == 0 );
35     /* Closing tmpfile */
36     TESTCASE( fclose( fh ) == 0 );
37     /* Checking that file was deleted */
38     TESTCASE_NOREG( fopen( filename, "r" ) == NULL );
39     return TEST_RESULTS;
40 }
41
42 #endif