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