'tmpfile func'에 해당되는 글 1건

  1. 2021.11.20 Watcom C Library : tan, tanh, tell, time, tmpfile

 

 

Watcom C Library Reference : tan, tanh, tell, time, tmpfile

 

 

 

 

tan

 

Synopsis : #include <math.h> 

              double tan( double x );

 


Description : The tan function computes the tangent of x (measured in radians). A large magnitude argument may yield a result with little or no significance.

 

 

Returns : The tan function returns the tangent value. When an error has occurred, errno contains a value  indicating the type of error that has been detected.

 

 

See Also : atan, atan2, cos, sin, tanh

 


Example :

#include <stdio.h> 

#include <math.h>


void main( )

{
    printf( "%f\n", tan (.5) );

}

 


produces the following :
0.546302

 

Classification : ANSI
Systems : All

 

 

 

 

 

 

 

tanh

 

Synopsis : #include <math.h> 

              double tanh( double x );

 


Description : The tanh function computes the hyperbolic tangent of x.  When the x argument is large, partial or total loss of significance may occur. The matherr function will be invoked in this case.

 

 

Returns : The tanh function returns the hyperbolic tangent value. When an error has occurred, errno contains a value indicating the type of error that has been detected.

 

 

See Also : cosh, sinh, matherr

 


Example :

#include <stdio.h> 

#include <math.h>


void main( )

{
    printf( "%f\n", tanh (.5) );

}

 


produces the following :
0.462117

 

Classification : ANSI
Systems : All

 

 

 

 

 

 

tell

 

Synopsis : #include <io.h> 

              long int tell( int handle );

 


Description : The tell function determines the current file position at the operating system level. The handle value is the file handle returned by a successful execution of the open function.


The returned value may be used in conjunction with the lseek function to reset the current file position.

 

 

Returns : When an error occurs, -1 is returned. When an error has occurred, errno contains a value indicating the type of error that has been detected.


Otherwise, the current file position is returned in a system-dependent manner. A value of 0 indicates the start of the file.

 

 

See Also : chsize, close, creat, dup, dup2, eof, exec Functions, filelength, fileno, fstat, isatty, lseek, open, read, setmode, sopen, stat, write, umask

 


Example :

#include <stdio.h>

#include <sys\stat.h> 

#include <io.h> 

#include <fcntl.h>


char buffer[] = { "A text record to be written" };


void main( )

{
    int     handle;

    int     size_written;


    /* open a file for output /*

    /* replace existing file if it exists */

    handle = open( "file", O_WRONLY | O_CREAT | O_TRUNC | O_TEXT, 

                            S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );


    if( handle != -1 ) {
        /* print file position */

        printf( "%d\n", tell( handle ) );


        /* write the text */

        size_written = write( handle, buffer, sizeof( buffer ) ) ;


        /* print file position */

        printf( "%d\n", tell( handle ) );


        /* close the file */

        close ( handle );

    }

}

 


produces the following :
0

28

 

Classification : WATCOM
Systems : All

 

 

 

 

 

 

 

time

 

Synopsis : #include <time.h> 

              time_t time( time_t *tloc );

 


Description : The time function determines the current calendar time and encodes it into the type time_t.


The time represents the time since January 1, 1970 Coordinated Universal Time (UTC) (formerly known as Greenwich Mean Time (GMT)).


The time set on the computer with the DOS time command and the DOS date command reflects the local time. The environment variable TZ is used to establish the time zone to which this local time applies. See the section The TZ Environment Variable for a discussion of how to set the time zone.

 

 

Returns : The time function returns the current calendar time. If tloc is not NULL, the current calendar time is also stored in the object pointed to by tloc.

 

 

See Also : asctime, clock, ctime, difftime, gmtime, localtime, mktime, strftime, tzset

 


Example :

#include <stdio.h> 

#include <time.h>


void main( )

{
    time_t    time_of_day;
   

    time_of_day = time( NULL );

    printf( "It is now : %s", ctime ( &time_of_day ) );

}

 

 

produces the following :
It is now : Fri Dec 25 15:58:42 1999

 

Classification : ANSI, POSIX 1003.1
Systems : All

 

 

 

 

 

 

 

tmpfile

 

Synopsis : #include <stdio.h> 

              FILE *tmpfile( void );

 


Description : The tmpfile function creates a temporary binary file that will automatically be removed when it is closed or at program termination. The file is opened for update.

 

 

Returns : The tmpfile function returns a pointer to the stream of the file that it created. If the file cannot be created, the tmpfile function returns NULL. When an error has occurred, errno contains a value indicating the type of error that has been detected.

 

 

See Also : fopen, freopen, tmpnam

 


Example :

#include <stdio.h>


static FILE *TempFile;


void main( )

{
    TempFile = tmpfile( );

    /*  .  */

    /*  .  */

    /*  .  */

    fclose( TempFile );

}

 

Classification : ANSI
Systems : All

 

 

 

 

 

 

 

 

 

 

This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).

 

WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)

 

 

 

728x90
반응형
Posted by 전화카드
,