utils.h

[Description]            [Macros]            [Functions]            [Classes]            [Specials]

Description[Back]

This header is a declaration of global functions. Various sorts of useful functions are defined. See section functions.

Macros[Back]

Name Description
None.

Functions[Back]

returns a random float number from the inteval <0,max)
Name Description
long double AntFloatRandom(long double max) type_description
uint AntRandom(uint max) returns a random integer number from the interval <0,max-1>
void AntRandomize() initialise a random number generator
BOOL Happened(TProb Chance) returns TRUE with probability specified by the Chance parameter
long FileSize(const char *FileName) returns the size (in bytes) of the file specified by Filename if the file does not exist 0is returned
BOOL FileExist(const char *FileName) returns TRUE if the file exists
Conversion routines these functions should be used everywhere any conversion between types is used. Especially when a project specific types are used.
type2 type12type2 (type1 src) converts a type1 to type2
BOOL TProb2BOOL(TProb src) behaves like the Happened function
char *type2string(type src,char *buf) Converts a src value of type type to his text form. The result is placed into the buf. Be sure that there is enough allocated space for the string value.

Classes[Back]

None.

Specials[Back]

Do not hesitate to add any function to simplify the process of compatibility building of classes, modules or platforms.
Use these utilities, whenever it is reasonable.

Reference ManualProject Antares