Watcom C Library Reference : atexit, atof, atoi, atol
Watcom C Reference/A - B - C 2021. 6. 14. 18:15
WATCOM C Library Reference : atexit, atof, atoi, atol
atexit
Synopsis : #include <stdlib.h>
int atexit( void (*func) (void) );
Description : The atexit function is passed the address of function func to be called when the program terminates normally. Successive calls to atexit create a list of functions that will be executed on a "last-in, first-out" basis. No more than 32 functions can be registered with the atexit function.
The functions have no parameters and do not return values.
Returns : The atexit function returns zero if the registration succeeds, non-zero if it fails.
See Also : abort, -exit, exit
Example :
#include <stdio.h>
#include <stdlib.h>
void main( )
{
void func1 (void), func2 (void), func3 (void);
atexit( func1 );
atexit( func2 );
atexit( func3 );
printf( "Do this first.\n" );
}
void func1 (void) { printf( "last.\n" ); }
void func2 (void) { printf( "this " ); }
void func3 (void) { printf( "Do " ); }
produces the following :
Do this first.
Do this last.
Classification : ANSI
Systems : All
atof
Synopsis : #include <stdlib.h>
double atof( const char *ptr );
Description : The atof function converts the string pointed to by ptr to double representation. It equivalent to
strtod( ptr. (char **)NULL )
Returns : The atof function returns the converted value. Zero is returned when the input string cannot be converted. When an error has occurred, errno contains a value indicating the type of error that has been detected.
See Also : sscanf, strtod
Example :
#include <stdlib.h>
void main( )
{
double x;
x = atof( "3.1415926" );
}
Classification : ANSI
Systems : All
atoi
Synopsis : #include <stdlib.h>
int atoi ( const char *ptr );
Description : The atoi function converts the string pointed to by ptr to int representation.
Returns : The atoi function returns the converted value.
See Also : sscanf, strtol
Example :
#include <stdlib.h>
void main( )
{
int x;
x = atoi( "-289" );
}
Classification : ANSI
Systems : All
atol
Synopsis : #include <stdlib.h>
long int atol( const char *ptr );
Description : The atol function converts the string pointed to by ptr to long int representation.
Returns : The atol function returns the converted value.
See Also : sscanf, strtol
Example :
#include <stdlib.h>
void main( )
{
long int x;
x = atol( "-289" );
}
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)