'왓콤C'에 해당되는 글 20건

  1. 2021.06.13 Watcom C Library Reference : acos, acosh, alloca

 

 

WATCOM C Library Reference : acos, acosh, alloca

 

 

 

 

acos

 

Synopsis : #include <math.h> 

              double acos ( double x );

Description : The acos function computes the principal value of the arccosine of x. A domain error occurs for arguments not in the range [-1,1].


Returns   :  The acos function returns the arccosine in the range [0,π]. When the argument is outside the permissible range, the matherr function is called. Unless the default matherr function is replaced, it will set the global variable errno to EDOM, and print a "DOMAIN error" diagnostic message using the stderr stream.

 

See Also : asin, atan, atan2, matherr

 


Example :

#include <stdio.h> 

#include <math.h>
void main()

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

}

 

produces the following :

1.047197

 


Classification : ANSI
Systems : All

 

 

 

acosh

 

Synopsis : #include <math.h> 

              double acosh( double x);

Description : The acosh function computes the inverse hyperbolic cosine of x. A domain error occurs if the value of x is less than 1.0.

 

Returns : The acosh function returns the inverse hyperbolic cosine value. When the argument is outside the permissible range, the matherr function is called. Unless the default matnes function is replaced, it will set the global variable errno to EDOM, and print a "DON error" diagnostic message using the stderr stream.


See Also : asinh, atanh, cosh, matherr

 


Example :
#include <stdio.h> 

#include <math.h>
void main()
{
    printf ( "%f\n", acosh ( 1.5 ) );

}

 

produces the following :

0.962424

 


Classification : WATCOM
Systems : All


 

 

alloca

 

Synopsis : #include <malloc.h> 

              void *alloca ( size_t size );

Description : The alloca function allocates space for an object of size bytes from the stack. The allocated space is automatically discarded when the current function exits. The alloca function should not be used in an expression that is an argument to a function.


Returns : The alloca function returns a pointer to the start of the allocated memory. The return value is NULL if there is insufficient stack space available.

See Also : calloc, malloc, stackavail

 


Example :
#include <stdio.h> 

#include <string.h> 

#include <malloc.h> 

FILE *open_err_file( char * );


void main()

{
    FILE * fp;
    fp = open_err_file( "alloca" );

    if( fp == NULL) {
        printf("Unable to open error file\n" );

    } else {
        fclose(fp);

    }
}

 

FILE *open_err_file( char *name )

{
    char *buffer;

 

    /* allocate temp buffer for file name */

    buffer = (char *) alloca ( strlen (name) + 5);

    if( buffer ) {
        sprintf( buffer, "%s.err", name );

        return( fopen( buffer, "w" ) );

    }
    return( (FILE *) NULL );

}

 

 

Classification : WATCOM
Systems : MACRO

 

 

 

 

 

 

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 전화카드
,