• Aucun résultat trouvé

fmod, fmodl

Dans le document Library Reference (Page 121-127)

Function Syntax

'mod 'modI

See memchr.

See memcmp.

See memcpy.

See memicmp. '

See memmove.

See memset.

math.h

Calculates x modulo y, the remainder of x/yo

double frnod{double X, double y) ;

long double frnodl{long double X, long double y);

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

• •

• • • •

• •

• •

Remarks

Return value See also

_fmovmem

fnmerge

Function Syntax

Remarks

Return value See also

fmod, fmodl

fmod calculates x modulo y (the remainder f, where x = ay + f for some integer a and 0 5.f < y). fmodl is the long double version; it takes long double arguments and returns a long double result.

fmod and fmodl return the remainder f, where x

=

ay + f (as described).

Where y = 0, fmod and fmodl return O.

ceil, floor, modf

See movmem.

Builds a path from component parts.

dir.h

vaid fnmerge(char *path, canst char *drive, canst char *dir, canst char *narne, canst char *ext);

fnmerge makes a path name from its components. The new path name is X:\DIR\SUBDIR\NAME.EXT

where drive

=

X:

dir

=

\DIR\SUBDIR\

name

=

NAME

ext

=

. EXT

fnmerge assumes there is enough space in path for the constructed path name. The maximum constructed length is MAXP A TH. MAXP ATH is defined in dir.h.

fnmerge and fnsplit are invertible; if you split a given path with fnsplit, then merge the resultant components with fnmerge, you end up with path.

None.

fnsplit

fnsplit

fnsplit

Function Syntax

Remarks

Splits a full path name into its components.

int fnsplit(const char *path, char *drive, char *dir, char *narne, char *ext)i

fnsplit takes a file's full path name (path) as a string in the form X: \DIR\ SUBDIR\NAME.EXT

dir.h .

and splits path into its four components. It then stores those components in the strings pointed to by drive, dir, name, and ext. (All five components must be passed, but any of them can be a null, which means the corresponding component will be parsed but not stored.)

The maximum sizes for these strings are given by the constants MAXDRIVE, MAXDIR, MAXPATH, MAXFILE, and MAXEXT (defined in dir.h), and each size includes space for the null character.

Max Max

Constant 16·bit 32·bit St.ring

MAX PATH 80 260 path

MAXDRIVE 3 3 drive; includes colon (:)

MAXDIR 66 260 dir, includes leading and trailing backslashes 0)

MAXFILE 9 260 name

MAX EXT 5 260 ext, includes leading dot (.)

fnsplit assumes that there is enough space to store each non-null component.

When fnsplit splits path, it treats the punctuation as follows:

• drive includes the colon (C:, A:, and so on).

• dir includes the leading and trailing backslashes (\ BC\include \,

\source \, and so on).

• name includes the file name.

• ext includes the dot preceding the extension (.C, .EXE, and so on).

fnmerge and fnsplit are invertible; if you split a given path with fnsplit, then merge the resultant components with fnmerge, you end 'up with path.

Return value

See also

fopen

Function Syntax

Remarks

fnsplit

fnsplit returns an integer (composed of five flags, defined in dir.h) indicating which of the full path name components were present in path.

These flags and the components they represent are . EXTENSION

FILENAME DIRECTORY DRIVE WILDCARDS fnmerge

Opens a stream.

An extension A file name

A directory (and possibly subdirectories) A drive specification (see dir.h)

Wildcard~ (* or ?)

FILE *fapen(canst char' *filenarne; canst char *rnade} ;

stdio.h

fopen opens the file named by filename and associates a stream with it. fopen returns a pointer to be used to identify the stream in subsequent

operations. . .'

The mode string used in calls to fopen is one of the following values:

Value Description Open for reading only.

w Create for writing. If a file by that name already exists, it will be overwritten.

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

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

Wt Create a new file for update (reading and writing). If a file by that name already exists, it will be overwritten.

at Open fo~ append; open for update at the end of the file, or create if the file does not exist.

To specify that a given file is being opened or created in text mode, append a t to the mode string (rt, w+t, and so on). Similarly, to specify binary mode, append a b to the mode string (wb, a+b, and so on). fopen also allows the tor

fopen

Return value See also

Function Syntax

Remarks

Return value

See also

_fpreset

Function Syntax

b to be inserted between the letter and the + character in the mode string;

for example, rt+ is equivalent to r+t.

If a t or b is not given in the mode st:ring, the mode is governed hy the global variable Jmode. If Jmode is set to a_BINARY, files are opened in binary mode. If Jmode is set to a_TEXT, they are 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 followed directly by input without an intervening fseek or rewind, and input cannot be directly followed by output without an interveningfseek, rewind, or an input that encounters end-of-file.

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

creat, dup, fclose, fdopen ferror, Jmode (global variable), fread, freopen, fseek, fwrite, open, rewind, setbuf, setmode

Gets a, far address offset or segment.

unsigned FP_OFF(void far *p};

unsigned FP_SEG(void far *p};

dos.h

The FP _OFF macro can be used to get or set the offset of the far pointer p.

FP _SEC is a macro that gets or sets the segment value of the far pointer p.

FP _OFF returns an unsigned integer value representing an offset value.

FP _SEC returns an unsigned integer representing a segment value.

MK_FP, movedata, segread

float.h

Reinitializes floating-point math package.

void _fpreset(void};

jpreset

DOS UNIX Win 16

Remarks Jpreset reinitializes the floating-point math package. This function is usually used in conjunction with system or the exec ... or spawn ... functions.

It is also used to recover from floating-point errors before calling longjmp.

Return value See also

fprintf

Function Syntax

Remarks

. . If an 80x87 coprocessor is used in a program, a child process (executed by system or by an exec ... or spawn ... function) might alter the parent process' floating-point state.

If you use an 80x87, take the following precautions:

• Do not call system or an exec ... or spawn ... function while a floating-point expression is being ~valuated .

• Call Jpreset to reset the floating-point state after using system, exec ... , or spawn ... if there is any chance that the child process performed a floating-point operation with the 80x87.

None.

_clear87, _contro187, _status87

stdio.h

Writes formatted output to a stream.

int fprintf(FILE *stream, canst char *farmat[, argument, ... J);

See printffor details on format specifiers.

fprintf accepts a series of arguments, applies to each a format specifier contained in the format string pointed to by format, and outputs the formatted data to a stream. There must be the same number of format specifiers as arguments.

Return value fprintf returns the number of bytes output. In the event of error, it returns

EOF. .

See also cprintf, fscanf, printf, putc, sprintf

·fputc

fputc stdio.h

Function Puts a character on a stream.

Syntax int fputc (int c, FILE *stream);

Remarks fputc outputs character·c to the named stream.

. . For Win32s or Win32 GUI applications, stdout must be redirected.

Return value On success, fputc returns, the character c. On error, it returns EOP.

See also fgetc, putc

fputchar stdio.h

Function Outputs a character on stdout.

Syntax int fputchar (int c);

Remarks fputchar outputs character c to stdout. fputchar(c) is the same as fputc(c, stdout).

. . For Win32s or Win32 GUI applications, stdout must be redirected.

, Return value On success, fputchar returns the character c. On error, it returns EOF.

See also fgetchar, [reopen, putchar

fputs stdio.h

Function Outputs a string on a stream.

Syntax int fputs (const char *s, FILE *stream);.

Dans le document Library Reference (Page 121-127)