• Keine Ergebnisse gefunden

fabs, fabsl

Im Dokument Library Reference (Seite 108-114)

Function Syntax

fabs fabsl

exp, expl

Sometimes the arguments passed to these functions produce results that overflow or are incalculable. When the correct value overflows, exp returns the value HUGE_VAL and expl returns _LHUGE_ V AL. Results of exces-sivelyJarge magnitude cause the global variable errno to be set to

ERANGE Result out of range

On underflow, these functions return 0.0, and the glob~l variable errno is not changed. Error handling for these functions can be modified through the functions _matherr and _matherrl.

frexp, ldexp, log, loglO, _matherr, pow, powlO, sqrt

malloc.h

Grows or shrinks a heap block in place.

void *_expand(void *block, size_t size);

This function attempts to change the size of an allocated memory block without moving the block's location in the heap. The data in the block are not changed, up to the smaller of the old and new sizes of the block. The block must have been allocated earlier with malloc, calloc, or realloc, and must not have been freed~

If _expand is able to resize the block without moving it, _expand returns

a

pointer to the block, whose address is unchanged. If _expand is unsuccess-ful, it returns a NULL pointer and does not modify or resize the block.

calloc, malloc, reallQc,

'Retumsthe absolute value of a floating-point number.

double fabs(double x);

long double fabsl(long double x);

DOS UNIX Win 16 Win 32 ANSI C ANSI C++ OS/2

• • • • • •

• •

math.h

II

tabs, tabsl

Remarks Return value See also

. farcalloc

Function Syntax

Remarks

Return value See also

farfree

Function Syntax

Remarks

fabs calculates the absolute value of x, a double. fabsl is the long double version; it takes a long double argument and returns a long double result.

fabs and fabsl return the absolute value of x.

. abs, cabs, labs

alloc.h

Allocates memory from the far heap.

void far *farcalloc(unsigned long nunits, unsigned long unitsz)i

farcalloc allocates memory from the far heap for an array containing nunits elements, each unitsz bytes long.

For allocating from the far heap, note that .' All available RAM can be allocated .

• Blocks larger than 64K can be allocated .

• Far pointers (or huge pointers if blocks are larger than 64K) are used to access the allocated blocks.

In the compact and large memory models, farcalloc is similar, though not identi<:al, to calloc. It takes unsigned long parameters, while calloc takes unsigned parameters.

farcalloc returns a pointer to the newly allocated block, or NULL if not enough space exists for the new block.

calloc, farfree, farmalloc, malloc

alloc.h

Frees a block from far heap.

void farfree(void far * block)i

farfree releases a block of memory previously allocated from the far heap.'

Return value See also

farmalloc

Function Syntax

Remarks

Return value See also

farrealloc

Function Syntax

Remarks

farfree

In the small and medium memory models, blocks allocated by farmalloc cannot be freed with normal free, and blocks allocated with malloc canno,t be freed with farfree. In these models, the two heaps are completely distinct.

None.

farcalloc, farmalloc

alloc.h

Allocates from far heap.

void far *farmalloc(unsigned long nbytes)i

. farmalloc allocates a block of memory nbytes bytes long from the far heap.

For allocating from the far heap, note that

• All available RAM can be allocated.

• Blocks larger than 64K can be allocated.

• Far pointers are used to access the allocated blocks.

In the compact and large memory models, farmalloc is similar though not·

identical to malloc. It takes unsigned long parameters, while malloc takes unsigned parameters.

farmalloc returns a pointer to the newly allocated block, or NULL if not enough space exists for the new block.

farcalloc, farfree, farrealloc, malloc

alloc.h

Adjusts allocated block in far heap.

void far *farrealloc(void far *oldblock, unsigned long nbytes)i

DOS

farrealloc adjusts the size of the allocated block to nbytes, copying the contents to a new location, if necessary.

farrealloc

Return value

See also

fclose

Function Syntax

Remarks

Return value See also

fcloseall

Function Syntax

Remarks

For allocatmg from the far heap, note that , • All available RAM can be allocated .

• Blocks larger than 64K can be allocated .

• Far pointers are used to access the allocated blocks.

farrealloc (eturns the address of the reallocated block, which might be different than the address of the original block. If the block cannot be reallocated, farrealloc returns NULL.

fa rmalloc , realloc

stdio.h

Closes a stream.

- int fclose (FILE *strearnl;

fclose closes the named stream. All buffers associated with the stream are flushed before closing. System-allocated buffers are freed upon closing.

Buffers assigned with setbuf or setvbuf are not automatically freed. (But if setvbuf is passed null for the buffer pointer, it will free it upon close.) fclose retumsO on success. It returns EOF if any errors were detected.

close, fcloseall, fdopen, fflush; flushall, fopen, freopen

stdio.h

Closes open streams.

int fcloseall(voidlj

fcloseall closes all open streams except stdin, stdout, stdprn, stderr, and stdaux. stdpm and stdaux streams are not available on OS /2 and Win32.

Return value See also

fcvt

Function Syntax

Remarks

Return value See also

fdopen

Function Syntax

Remarks

fcloseall

fdoseall returns the total number of streams it closed. It returns EOF if any errors were detected.

fdose, fdopen, flushall, fopen, freopen

stdlib.h

Converts a floating-point number to a string.

char *fcvt(double value, int ndig, int *dec, int *sign);

fcvt converts value to a null-terminated string digit, starting with the leftmost significant digit, with ndig digits to the right of the decimal point.

fcvt then returns a pointer to the string. The position of the decimal point relative to the beginning of the string is stored indirectly through dec (a negative value for dec means to the left of the returned digits). There is no decimal point in the string itself. If the sign of value is negative, the word pointed to by sign is nonzero; otherwise, it is O.

The correct digit has been rounded for the number of digits to the right of the decimal point specified by ndig.

The return value of fcvt points to static data whose content is overwritten by each call to fcvt and ecvt.

ecvt, gcvt, sprintf

stdio.h

Associates a stream with a file handle.

FILE *fdopen(int handle, char *type);

fdopen associates a stream with a file handle obtained from creat, dup, dup2, or open. The type of stream must match the mode of the open handle.

The type string used in a call to fdopen is one of the following values:

fdopen

Return value See also

feaf

Function Syntax

Remarks

Value Description r Open for reading only.

w Create for writing.

a Append; open for writing at end-of-file, or create for writing if the file does not exist.

r+ Open an existing file for update (reading and writing).

w+ Create a new file for update.

a+ Open for append; open (or create if the file does not exist) for update at the end of the file.

To specify that a given file is being opened or created in text mode, append a t to the value of the type string (rt, w+t, and so on); similarly, to specify binary mode, append a b to the type string (wb, a+b, and so on).

If a t or b is not given in the type string, the mode is governed by the global variable Jmode. If Jmode is set to a_BINARY, files will be opened in binary mode. If Jmode is set to a_TEXT, they will be opened in text mode. These 0_ ... constants are defined in fcntl.h.

When a file is opened for update, both input and output can be done on the resulting stream. However, output cannot be directly followed by input without an intervening fseek or rewind, and input cannot be directly followed by output without an intervening fseek, rewind, or an input that encounters end-of-file.

On successful completion, fdopen returns a pointer to the newly opened stream. In the event of error, it returns NULL.

fcZose, fopen, freopen, open

stdio.h

Detects end-of-file on a stream.

int feof(FILE *stream);

, feof is a macro that tests the given stream for an end-of-file indicator. Once the indicator is set, read operations on the file return the indicator until rewind is called, or the file is closed.

Return value See also

ferror

Function Syntax

Remarks

Return value See also

fflush

Function Syntax

Remarks

Return value See also

feof

The end-of-file indicator is reset with each input operation.

feof returns nonzero if an end-of-file indicator was detected on the last input operation on the named stream, and 0 if end-of-file has not been reached.

clearerr, eof, ferror, perror

stdio.h

Detects errors on stream.

int ferror(FILE *stream)i

DOS UNIX I Win 16

Im Dokument Library Reference (Seite 108-114)