STDLIB
abs
Synopsis
#include
int abs(int j);
Description
The abs, function computes the absolute value of an integer j.If the result cannot be represented, the behavior is undefined.
Returns :
Returns the absolute value
Example :
#include
void main(void)
{
int i = -4;
printf("The absolute value of %d is %d\n",i,abs(i));
}
The absolute value of -4 is 4
access
Synopsis
#include
int _access(const char *path,int mode) ;
Description
The access function, when used with files, determines whether the specified file exists and can be accessed as specified by the value of mode. When used with directories, _access determines only whether the specified directory exists; since under Windows all directories have read and write access.
The mode argument can be one of :
00 Existence only
02 Write permission
04 Read permission
06 Read and write permission
Returns
Zero if the file has the given mode, -1 if an error occurs.
Portability :
Windows. Under Unix a similar function exists too.
Note that lcc-win32 accepts both _access (Microsoft convention) and access.
acos
Synopsis
#include
double acos(double x);
Description
The acos functions compute the principal value of the arc cosine of x. A domain error occurs for arguments not in the range [ 1, +1].
Returns
The acos functions return the arc cosine in the range [0, ?] radians.
asctime
Synopsis
#include
char *asctime(const struct tm *timeptr);
Description
The asctime function converts the broken-down time in the structure pointed to by timeptr into a string in the form
Sun Sep 16 01:03:52 1973\n\0
using the equivalent of the following algorithm.
char *asctime(const struct tm *timeptr)
{
static const char wday_name[7][3] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
static const char mon_name[12][3] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
static char result[26];
sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
wday_name[timeptr->tm_wday],
mon_name[timeptr->tm_mon],
timeptr->tm_mday, timeptr->tm_hour,
timeptr->tm_min, timeptr->tm_sec,
1900 + timeptr->tm_year);
return result;
}
Returns
The asctime function returns a pointer to the string.
Example :
#include
#include
void main(void)
{
struct tm *newtime;
time_t ltime;
/* Get the time in seconds */
time (<ime);
/* convert it to the structure tm */
newtime = localtime(<ime);
/* print the local time as a string */
printf("The current time and dat are %s", asctime(newtime));
}
The current time and dat are Mon Dec 28 12:33:50 1998
asin
Synopsis
#include
double asin(double x);
float asinf(float x);
long double asinl(long double x);
Description
The asin functions compute the principal value of the arc sine of x. A domain error occurs for arguments not in the range [ 1, +1].
Returns
The asin functions return the arc sine in the range [ ?/2, + ?/2] radians.
Example :
#include
#include
#include
#define MAX 1.0
#define MIN -1.0
void main(void)
{
double x,y;
printf("Enter x\n");
scanf("%lf", &x);
/* Output error if not in range */
if (x > MAX) {
printf("Error: %lf too large for asin\n",x);
}
else if (x < MIN) {
printf("Error: %lf is too small for asin\n",x);
}
else {
y = asin(x);
printf("asin ( %lf ) = %lf\n",x,y);
}
}
D:\lcc\examples>asin
Enter x
0.765
asin ( 0.765000 ) = 0.871041
D:\lcc\examples>asin
Enter x
5.9
Error: 5.900000 too large for asin
assert
Synopsis
#include
void assert(_Bool expression);
Description
The assert macro puts diagnostic tests into programs. When it is executed, if expression is false (that is, compares equal to 0), the assert macro writes information about the particular call that failed (including the text of the argument, the name of the source file, the source line number, and the name of the enclosing function the latter are respectively the values of the preprocessing macros __FILE__ and __LINE__ and of the identifier __func__) on the standard error file in an implementation-defined format. It then calls the abort function.
Returns
The assert macro returns no value.
atexit
Synopsis
#include
int atexit(void (*func)(void));
Description
The atexit function registers the function pointed to by func, to be called without
arguments at normal program termination.
Environmental limits
The implementation shall support the registration of at least 32 functions.
Returns
The atexit function returns zero if the registration succeeds, nonzero if it fails.
Example :
#include
#include
void goodbye(void)
{
printf("Goodbye\n");
}
void main(void)
{
int rc = atexit(goodbye);
if (rc != 0) {
printf("error setting at exit function\n");
}
exit(0);
}
When run, this program produces the following output :
Goodbye
atof
Synopsis
#include
double atof(const char *nptr);
Description
The atof function converts the initial portion of the string pointed to by nptr to double representation. Except for the behavior on error, it is equivalent to strtod(nptr, (char **)NULL)
Returns
The atof function returns the converted value.
Example :
#include
void main(void)
{
char *s;
s = "-2309.12E-5";
printf("%15.13g\n",atof(s));
}
D:\lcc\examples>atof
-0.0230912
atoi
Synopsis
#include
int atoi(const char *nptr);
Description
2 The atoi, function converts the initial portion of the string pointed to by nptr to int representation.
Except for the behavior on error, it is are equivalent to
atoi: (int)strtol(nptr, (char **)NULL, 10)
Returns
The atoi function returns the converted value.
atol
Synopsis
#include
long int atol(const char *nptr);
Description
The atol function converts the initial portion of the string pointed to by nptr to long int representation.
Except for the behavior on error, they are equivalent to
atol: strtol(nptr, (char **)NULL, 10)
Returns
The atol function returns the converted value.
beginthread
Synopsis
#include
unsigned long _beginthread(void(*start_address)(void *), unsigned stack_size,void *arglist) ;
Description
The _beginthread function creates a new thread of execution that begins at the start_address parameter. This routine should have no return value. When it exists, the thread is terminated. The arglist parameter is the argument of this function. It can be NULL.
To end the thread call endthread. In any case this is not necessary if the called function just exits.
Returns
If successfull, this function returns the handle of the newly created thread. If an error occurs the return value is -1, in which case errno is set to EAGAIN if there are too many threads running, or to EINVAL if the argument is invalid.
Portability
Windows
bsearch
Synopsis
#include
void *bsearch(const void *key, const void *base,size_t nmemb, size_t size,int (*compar)(const void *, const void *));
Description
The bsearch function searches an array of nmemb objects, the initial element of which is pointed to by base, for an element that matches the object pointed to by key. The size of each element of the array is specified by size.
The comparison function pointed to by compar is called with two arguments that point to the key object and to an array element, in that order. The function shall return an integer less than, equal to, or greater than zero if the key object is considered, respectively, to be less than, to match, or to be greater than the array element. The array shall consist of: all the elements that compare less than, all the elements that compare equal to, and all the elements that compare greater than the key object, in that order.
Returns
The bsearch function returns a pointer to a matching element of the array, or a null pointer if no match is found. If two elements compare as equal, which element is matched is unspecified.
cabs
Synopsis
#include
double cabs(struct complex n);
Description
The cabs function calculates the absolute value of the given complex number
Returns
The cabs function returns the absolute value of its complex argument.
calloc
Synopsis
#include
void *calloc(size_t nmemb, size_t size);
Description
The calloc function allocates space for an array of nmemb objects, each of whose size is size. The space is initialized to all bits zero.
Returns
The calloc function returns either a null pointer or a pointer to the allocated space.
ceil
Synopsis
#include
double ceil(double x);
Description
The ceil functions compute the smallest integer value not less than x: ??x ??.
Returns
The ceil functions return the smallest integer value not less than x, expressed as a floating-point number.
Example :
#include
#include
void main( void )
{
double y;
y = floor( 2.644 );
printf( "The floor of 2.644 is %f\n", y );
y = floor( -2.644 );
printf( "The floor of -2.644 is %f\n", y );
y = ceil( 2.955 );
printf( "The ceil of 2.955 is %f\n", y );
y = ceil( -2.955 );
printf( "The ceil of -2.955 is %f\n", y );
}
The floor of 2.644 is 2.000000
The floor of -2.644 is -3.000000
The ceil of 2.955 is 3.000000
The ceil of -2.955 is -2.000000
chdir
Synopsis
#include
int _chdir(const char *dirname) ;
Description
The chdir function changes the current directory to the specified one, that must exist.
Returns
The chdir function returns 0 if successful, -1 otherwise
Portability :
Windows
Note that lcc-win32 accepts both _chdir and chdir.
clearerr
Synopsis
#include
void clearerr(FILE *stream);
Description
The clearerr function clears the end-of-file and error indicators for the stream pointed to by stream.
Returns
The clearerr function returns no value.
clock
Synopsis
#include
clock_t clock(void);
Description
The clock function determines the processor time used.
Returns
The clock function returns the implementation’s best approximation to the processor time used by the program since the beginning of an implementation-defined era related only to the program invocation. To determine the time in seconds, the value returned by the clock function should be divided by the value of the macro CLOCKS_PER_SEC .If the processor time used is not available or its value cannot be represented, the function returns the value (clock_t)-1.
Example :
#include
#include
#include // For the Sleep function
void main(void)
{
double timedif;
double time1 = (double)clock();
time1 = time1/(double)CLOCKS_PER_SEC;
Sleep(1500);
timedif = (((double)clock()) / (double)CLOCKS_PER_SEC) - time1;
printf("The elapsed time is %f seconds\n",timedif);
}
D:\lcc\examples>clock
The elapsed time is 1.502000 seconds
copysign
Synopsis
#include
double copysign(double x, double y);
Description
The copysign function produces a value with the magnitude of x and the sign of y. They produce a NaN (with the sign of y) if xis a NaN. On implementations that represent a signed zero but do not treat negative zero consistently in arithmetic operations, the copysign functions regard the sign of zero as positive.
Returns
The copysign functions return a value with the magnitude of x and the sign of y.
Example :
#include
#include
void main(void)
{
double value = 45.98;
double sign = -10.0;
printf("The sign of %g times the magnitude of %g is %g\n", sign,
value, copysign(value,-1.0));
}
The sign of -10 times the magnitude of 45.98 is -45.98
cos
Synopsis
#include
double cos(double x);
Description
The cos function computes the cosine of x (measured in radians).
Returns
The cos function returns the cosine value.
cosh
Synopsis
#include
double cosh(double x);
Description
The cosh functions compute the hyperbolic cosine of x. A range error occurs if the magnitude of x is too large.
Returns
The cosh functions return the hyperbolic cosine value.
Example :
#include
#include
void main( void )
{
double pi = 3.1415926535;
double x, y;
x = pi / 2;
y = sin( x );
printf( "sin( %f ) = %f\n", x, y );
y = sinh( x );
printf( "sinh( %f ) = %f\n",x, y );
y = cos( x );
printf( "cos( %f ) = %f\n", x, y );
y = cosh( x );
printf( "cosh( %f ) = %f\n",x, y );
}
cputs
Synopsis
#include
int cputs(char *string);
Description
The cputs function prints the given character string at the console. The string should be zero terminated.
Returns
If successful, returns zero.. If an error occurs it returns -1
ctime
Synopsis
#include
char *ctime(const time_t *timer);
Description
The ctime function converts the calendar time pointed to by timer to local time in the
form of a string. It is equivalent to
asctime(localtime(timer))
Returns
The ctime function returns the pointer returned by the asctime function with that broken-down time as argument.
Example :
#include
#include
void main(void)
{
time_t ltime;
time(<ime);
printf("The time now is %s",ctime(<ime));
}
cwait
Synopsis
#include
int _cwait(int *termstat,int procHandle,int action);
Description
The cwait function waits for the termination of the process ID of the specified process that is provided by procHandle. The value of procHandle passed to _cwait should be the value returned by the call to the _spawn function that created the specified process. If the process ID terminates before _cwait is called, _cwait returns immediately. _cwait can be used by any process to wait for any other known process for which a valid handle (procHandle) exists.
termstat points to a buffer where the return code of the specified process will be stored. The value of termstat indicates whether the specified process terminated 搉ormally by calling the Windows NT ExitProcess API. ExitProcess is called internally if the specified process calls exit or _exit, returns from main, or reaches the end of main.. If _cwait is called with a NULL value for termstat, the return code of the specified process will not be stored.
The action parameter is ignored
Returns
When the specified process has 搒uccessfully completed, _cwait returns the handle of the specified process and sets termstat to the result code returned by the specified process. Otherwise, _cwait returns –1
Portability :
Windows
Note that lcc-win32 accepts _cwait (Microsoft convention) and cwait..
difftime
Synopsis
#include
double difftime(time_t time1, time_t time0);
Description
The difftime function computes the difference between two calendar times: time1 -time0.
Returns
The difftime function returns the difference expressed in seconds as a double.
Example :
#include
#include
#define RUNS 1000
#define SIZE 10000
int mark[SIZE];
void main (void)
{
time_t start,finish;
int i,loop,n,num;
time(&start);
/* This loop find the prime numbers between 2 and SIZE */
for (loop=0; loop for (n=0; n /* This loop marks all the composite numbers with -1 */
for (num=0,n=2;n if (!mark[n]) {
for (i=2*n;i mark[i] = -1;
}
}
num++;
}
}
}
time(&finish);
printf("\nProgram takes") ;
printf(" an average of %f seconds to find %d primes\n",
difftime(finish,start)/RUNS,num);
}
D:\lcc\examples>lcc difftime.c
D:\lcc\examples>lcclnk difftime.obj
D:\lcc\examples>difftime
Program takes an average of 0.002000 seconds to find 9998 primes
D:\lcc\examples>lcc -O difftime.c
D:\lcc\examples>lcclnk difftime.obj
D:\lcc\examples>difftime
Program takes an average of 0.001000 seconds to find 9998 primes
div
Synopsis
#include
div_t div(int numer, int denom);
Description
The div, ldiv, and lldiv, functions compute numer / denom and numer %
denom in a single operation.
Returns
The div functions return a structure of type div_t, ldiv_t comprising both the quotient and the remainder. The structures shall contain (in either order) the members quot (the quotient) and rem (the remainder), each of which have the same type as the arguments numer and denom.If either part of the result cannot be represented, the behavior is undefined.
dup dup2
Synopsis
#include
int dup(int handle);
int dup2(int handle1,int handle2) ;
Description
The _dup and _dup2 functions associate a second file handle with a currently open file. These functions can be used to associate a predefined file handle, such as that for stdout, with a different file. Operations on the file can be carried out using either file handle. The type of access allowed for the file is unaffected by the creation of a new handle. _dup returns the next available file handle for the given file._dup2 forces handle2 to refer to the same file as handle1. If handle2 is associated with an open file at the time of the call, that file is closed.
Both _dup and _dup2 accept file handles as parameters. To pass a stream (FILE *) to either of these functions, use _fileno. The fileno routine returns the file handle currently associated with the given stream. The following example shows how to associate stderr (defined as FILE * in STDIO.H) with a handle:
ccstderr = _dup( _fileno( stderr ));
Returns
_dup returns the new file handle, _dup2 returns zero to indicate success. Otherwise it returns -1.
ecvt
Synopsis
#include
char *_ecvt(double value,int count,int *dec,int *sign);
Description
converts a floating-point number to a character string. The value parameter is the floating-point number to be converted. This function stores up to count digits of value as a string and appends a null character If the number of digits in value exceeds count, the low-order digit is rounded. If there are fewer than count digits, the string is padded with zeros.
Only digits are stored in the string. The position of the decimal point and the sign of value can be obtained from dec and sign after the call. The dec parameter points to an integer value giving the position of the decimal point with respect to the beginning of the string. A 0 or negative integer value indicates that the decimal point lies to the left of the first digit. The sign parameter points to an integer that indicates the sign of the converted number. If the integer value is 0, the number is positive. Otherwise, the number is negative.
_ecvt and _fcvt use a single statically allocated buffer for the conversion. Each call to one of these routines destroys the result of the previous call.
Portability :
Windows / Unix
endthread
Synopsis
#include
void enthread(void) ;
Description
The endthread function terminates the currently running thread.
Returns
This function returns no value.
Portability :
Windows
eof
Synopsis :
#include
int eof(int handle) ;
Description :
This function tests whether the file represented by its handle argument has reached the end of the file or not.
Returns :
Returns 0 if the end of file hasn’t been reached, 1 if the handle is at EOF, -1 if there is an error.
Portability
Windows. Under Unix a similar function exists for the TCL library, but not for the C library.
errno
Synopsis :
extern int errno ;
Description :
errno is set on an error in a system-level call. Because errno holds the value for the last call that set it, this value may be changed by succeeding calls. Always check errno immediately before and after a call that may set it. All errno values, defined as manifest constants in ERRNO.H, are UNIX-compatible. The values valid for 32-bit Windows applications are a subset of these UNIX values.
On an error, errno is not necessarily set to the same value as the error code returned by a system call. For I/O operations only, use _doserrno to access the operating-system error-code equivalents of errno codes. For other operations the value of _doserrno is undefined.
Each errno value is associated with an error message that can be printed using perror or stored in a string using strerror. perror and strerror use the _sys_errlist array and _sys_nerr, the number of elements in _sys_errlist, to process error information.
Name String value Numerical value
E2BIG Argument list too long 7
EACCES Permission denied 13
EAGAIN No more processes or not enough memory or maximum nesting level reached 11
EBADF Bad file number 9
ECHILD No spawned processes 10
EDEADLOCK Resource deadlock would occur 36
EDOM Math argument 33
EEXIST File exists 17
EINVAL Invalid argument 22
EMFILE Too many open files 24
ENOENT No such file or directory 2
ENOEXEC Exec format error 8
ENOMEM Not enough memory 12
ENOSPC No space left on device 28
ERANGE Result too large 34
EXDEV Cross-device link 18
exit
Synopsis
#include
void exit(int status);
Description
The exit function causes normal program termination to occur. If more than one call to the exit function is executed by a program, the behavior is undefined.
First, all functions registered by the atexit function are called, in the reverse order of their registration.237)
Next, all open streams with unwritten buffered data are flushed, all open streams are closed, and all files created by the tmpfile function are removed.
Finally, control is returned to the host environment. If the value of status is zero or EXIT_SUCCESS, an implementation-defined form of the status successful termination is returned. If the value of status is EXIT_FAILURE, an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation - defined.
Returns
The exit function cannot return to its caller.
exp
Synopsis
#include
double exp(double x);
Description
The exp function computes the base-e exponential of x: e x . A range error occurs if the magnitude of x is too large.
Returns
The exp function returns the exponential value.
expand
Synopsis
void *_expand(void *memoryblock,size_t newsize) ;
Description
The _expand function changes the size of a previously allocated memory block by trying to expand or contract the block without moving its location in the heap. The memblock parameter points to the beginning of the block. The size parameter gives the new size of the block, in bytes. The contents of the block are unchanged up to the shorter of the new and old sizes. If you like risky things, memblock can also point to a block that has been freed, as long as there has been no intervening call to calloc, _expand, malloc, or realloc. If memblock points to a freed block, the block remains free after a call to _expand.
Returns
A pointer to the expanded memory block (that should be the same as its memoryblock argument since _expand doesn’t move its argument) or NULL if there is not enough memory to change the size of the block without moving it.
Portability
Windows
fabs
Synopsis
#include
double fabs(double x);
Description
The fabs functions compute the absolute value of a floating-point number x.
Returns
The fabs functions return the absolute value of x.
Example :
/* ABS.C: This program computes and displays the absolute values of several
* numbers, using fabs, labs and abs
*/
#include
#include
#include
void main( void )
{
int ix = -5, iy;
long lx = -62458L, ly;
double dx = -4.966321, dy;
iy = abs( ix );
printf( "The absolute value of %d is %d\n", ix, iy);
ly = labs( lx );
printf( "The absolute value of %ld is %ld\n", lx, ly);
dy = fabs( dx );
printf( "The absolute value of %f is %f\n", dx, dy );
}
Output :
The absolute value of -5 is 5
The absolute value of -62458 is 62458
The absolute value of -4.966321 is 4.966321
fclose
Synopsis
#include
int fclose(FILE *stream);
Description
The fclose function causes the stream pointed to by stream to be flushed and the associated file to be closed. Any unwritten buffered data for the stream are delivered to the host environment to be written to the file; any unread buffered data are discarded. The stream is disassociated from the file. If the associated buffer was automatically allocated, it is deallocated.
Returns
The fclose function returns zero if the stream was successfully closed, or EOF if any errors were detected.
feof
Synopsis
#include
int feof(FILE *stream);
Description
The feof function tests the end-of-file indicator for the stream pointed to by stream.
Returns
The feof function returns nonzero if and only if the end-of-file indicator is set for stream.
ferror
Synopsis
#include
int ferror(FILE *stream);
Description
The ferror function tests the error indicator for the stream pointed to by stream.
Returns
The ferror function returns nonzero if and only if the error indicator is set for stream.
fflush
Synopsis
#include
int fflush(FILE *stream);
Description
If stream points to an output stream or an update stream in which the most recent operation was not input, the fflush function causes any unwritten data for that stream to be delivered to the host environment to be written to the file; otherwise, the behavior is undefined.
If stream is a null pointer, the fflush function performs this flushing action on all streams for which the behavior is defined above.
Returns
The fflush function sets the error indicator for the stream and returns EOF if a write error occurs, otherwise it returns zero.
Example :
#include
#include
void main( void )
{
int integer;
char string[81];
/* Read each word as a string. */
printf( "Enter a sentence of 3 words with scanf: " );
for( integer = 0; integer < 3; integer++ )
{
scanf( "%s", string );
printf( "%s\n", string );
}
/* You must flush the input buffer before using gets. */
fflush( stdin );
printf( "Enter the same sentence with gets: " );
gets( string );
printf( "%s\n", string );
}
Enter a sentence of 3 words with scanf: hello my world
hello
my
world
Enter the same sentence with gets: hello my world
hello my world
fgetc
Synopsis
#include
int fgetc(FILE *stream);
Description
If a next character is present from the input stream pointed to by stream, the fgetc function obtains that character as an unsigned char converted to an int and advances the associated file position indicator for the stream (if defined).
Returns
The fgetc function returns the next character from the input stream pointed to by stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and fgetc returns EOF. If a read error occurs, the error indicator for the stream is set and fgetc returns EOF.
fgetpos
Synopsis
#include
int fgetpos(FILE * restrict stream, fpos_t * restrict pos);
Description
The fgetpos function stores the current values of the parse state (if any) and file position indicator for the stream pointed to by stream in the object pointed to by pos.
The values stored contain unspecified information usable by the fsetpos function for repositioning the stream to its position at the time of the call to the fgetpos function.
Returns
If successful, the fgetpos function returns zero; on failure, the fgetpos function returns nonzero and stores an implementation-defined positive value in errno. For lcc-win32, this values are :
? EBADF Bad file handle
? EINVAL The pos value is invalid
fgets
Synopsis
#include
char *fgets(char * restrict s, int n,FILE * restrict stream);
Description
The fgets function reads at most one less than the number of characters specified by n from the stream pointed to by stream into the array pointed to by s. No additional characters are read after a new-line character (which is retained) or after end-of-file. A null character is written immediately after the last character read into the array.
Returns
The fgets function returns s if successful. If end-of-file is encountered and no characters have been read into the array, the contents of the array remain unchanged and a null pointer is returned. If a read error occurs during the operation, the array contents are indeterminate and a null pointer is returned.
findclose
Synopsis
#include
int findclose(long handle);
Description
The _findclose function closes the given find handle and releases the associated resources.
Returns
0 if successful, -1 otherwise.
findfirst
Synopsis
#include
long _findfirst(char *filespec, struct _finddata_t *fileinfo);
Description
The _findfirst function returns a unique search handle identifying the file (or group of files) matching the specification indicated by the filespec argument. This handle can be used in a later call to its related function _findnext.
Returns
The findfile handle if sucessfull, or -1 on failure.
findnext
Synopsis
#include
int findnext(long handle, struct _finddata_t *fileinfo);
Description
The _findnext function find the next file that correspond to the specifications that were passed for the handle handle to find first. The data for the name of the file is returned in the cname member of the _finddata_t structure.
Returns
If successful, returns 0.Else, the result is -1
Portability :
Windows
fmod
Synopsis
#include
double fmod(double x, double y);
Description
The fmod functions compute the floating-point remainder of x / y.
Returns
The fmod functions return the value x ??ny, for some integer n such that, if y is nonzero, the result has the same sign as x and magnitude less than the magnitude of y. If y is zero, whether a domain error occurs or the fmod functions return zero is implementation-defined.
Under lcc-win32 the result is a quiet NAN.
floor
Synopsis
#include
double floor(double x);
Description
The floor functions compute the largest integer value not greater than x: ??x ??.
Returns
The floor functions return the largest integer value not greater than x, expressed as a floating-point number.
Example :
#include
#include
void main( void )
{
double y;
y = floor( 2.644 );
printf( "The floor of 2.644 is %f\n", y );
y = floor( -2.644 );
printf( "The floor of -2.644 is %f\n", y );
y = ceil( 2.955 );
printf( "The ceil of 2.955 is %f\n", y );
y = ceil( -2.955 );
printf( "The ceil of -2.955 is %f\n", y );
}
The floor of 2.644 is 2.000000
The floor of -2.644 is -3.000000
The ceil of 2.955 is 3.000000
The ceil of -2.955 is -2.000000
fopen
Synopsis
#include
FILE *fopen(const char * filename,const char * mode);
Description
The fopen function opens the file whose name is the string pointed to by filename, and associates a stream with it. The argument mode points to a string. If the string is one of the following, the file is open in the indicated mode. Otherwise, the behavior is undefined.
r open text file for reading
w truncate to zero length or create text file for writing
a append; open or create text file for writing at end-of-file
rb open binary file for reading
wb truncate to zero length or create binary file for writing
ab append; open or create binary file for writing at end-of-file
r+ open text file for update (reading and writing)
w+ truncate to zero length or create text file for update
a+ append; open or create text file for update, writing at end-of-file
r+b or rb+ open binary file for update (reading and writing)
w+b or wb+ truncate to zero length or create binary file for update
a+b or ab+ append; open or create binary file for update, writing at end-of-file
Opening a file with read mode (’r’ as the first character in the mode argument) fails if the file does not exist or cannot be read.
Opening a file with append mode (’a’ as the first character in the mode argument) causes all subsequent writes to the file to be forced to the then current end-of-file, regardless of intervening calls to the fseek function. In some implementations, opening a binary file with append mode (’b’ as the second or third character in the above list of mode argument values) may initially position the file position indicator for the stream beyond the last data written, because of null character padding. When a file is opened with update mode (’+’ as the second or third character in the above list of mode argument values), both input and output may be performed on the associated stream. However, output shall not be directly followed by input without an intervening call to the fflush function or to a file positioning function (fseek,fsetpos,orrewind), and input shall not be directly followed by output without an intervening call to a file positioning function, unless the input operation encounters end-of- file. Opening (or creating) a text file with update mode may instead open (or create) a binary stream in some implementations.
When opened, a stream is fully buffered if and only if it can be determined not to refer to an interactive device. The error and end-of-file indicators for the stream are cleared.
Returns
The fopen function returns a pointer to the object controlling the stream. If the open operation fails, fopen returns a null pointer.
_fpclass
Synopsis
#include
int _fpclass(double n);
Description
The _fpclass function returns an integer that represent the different forms of classifying the given double precision value.
This values (defined in float.h) are :
_FPCLASS_SNAN Signaling NaN
_FPCLASS_QNAN Quiet NaN
_FPCLASS_NINF Negative infinity ( –INF)
_FPCLASS_NN Negative normalized non-zero
_FPCLASS_ND Negative denormalized
_FPCLASS_NZ Negative zero ( – 0)
_FPCLASS_PZ Positive 0 (+0)
_FPCLASS_PD Positive denormalized
_FPCLASS_PN Positive normalized non-zero
_FPCLASS_PINF Positive infinity (+INF)
Returns
The classification of its argument x.
Portability :
Windows (x86 specific). Note that lcc-win32 supports both _fpclass and fpclass.
_fpreset
Synopsis
#include
int _freset(void);
Description
This function resets the numerical coprocessor and its associated run time variables.
Returns :
This function returns no value.
fprintf
Synopsis
#include
int fprintf(FILE * restrict stream, const char * restrict format, ...);
Description
The fprintf function writes output to the stream pointed to by stream, under control of the string pointed to by format that specifies how subsequent arguments are converted for output. If there are insufficient arguments for the format, the behavior is undefined. If the format is exhausted while arguments remain, the excess arguments are evaluated (as always) but are otherwise ignored. The fprintf function returns when the end of the format string is encountered. The format shall be a multibyte character sequence, beginning and ending in its initial shift state. The format is composed of zero or more directives: ordinary multibyte characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments, converting them, if applicable, according to the corresponding conversion specifier, and then writing the result to the output stream.
Each conversion specification is introduced by the character %. After the %, the following appear in sequence:
? Zero or more flags (in any order) that modify the meaning of the conversion specification.
? An optional minimum field width. If the converted value has fewer characters than the field width, it is padded with spaces (by default) on the left (or right, if the left adjustment flag, described later, has been given) to the field width. The field width takes the form of an asterisk * (described later) or a decimal integer.
? An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x, and X conversions, the number of digits to appear after the decimal-point character for a, A, e, E, f, and F conversions, the maximum number of significant digits for the g and G conversions, or the maximum number of characters to be written from a string in s conversions. The precision takes the form of a period (.) followed either by an asterisk * (described later) or by an optional decimal integer; if only the period is specified, the precision is taken as zero. If a precision appears with any other conversion specifier, the behavior is undefined.
? An optional length modifier that specifies the size of the argument.
? A conversion specifier character that specifies the type of conversion to be applied.
As noted above, a field width, or precision, or both, may be indicated by an asterisk. In this case, an int argument supplies the field width or precision. The arguments specifying field width, or precision, or both, shall appear (in that order) before the argument (if any) to be converted. A negative field width argument is taken as a - flag followed by a positive field width. A neg ative precision argument is taken as if the precision were omitted.
The flag characters and their meanings are:
? - (dash) The result of the conversion is left-justified within the field. (It is right-justified if this flag is not specified.)
? + The result of a signed conversion always begins with a plus or minus sign. (It begins with a sign only when a negative value is converted if this flag is not specified.)
? space If the first character of a signed conversion is not a sign, or if a signed conversion results in no characters, a space is prefixed to the result. If the space and + flags both appear, the space flag is ignored.
? # The result is converted to an ‘‘alternative form’’. For o conversion, it increases the precision, if and only if necessary, to force the first digit of the result to be a zero (if the value and precision are both 0, a single 0 is printed). For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g, and G conversions, the result always contains a decimal-point character, even if no digits follow it. (Normally, a decimal-point character appears in the result of these conversions only if a digit follows it.) For g and G conversions, trailing zeros are not removed from the result. For other conversions, the behavior is undefined.
? 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros (following any indication of sign or base) are used to pad to the field width; no space padding is performed. If the 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X conversions, if a precision is specified, the 0 flag is ignored. For other conversions, the behavior is undefined.
The length modifiers and their meanings are:
hh Specifies that a following d, i, o, u, x,or X conversion specifier applies to a signed char or unsigned char argument (the argument will have been promoted according to the integer promotions, but its value shall be converted to signed char or unsigned char before printing); or that a following n conversion specifier applies to a pointer to a signed char argument.
Not implemented in CRTDLL.DLL, therefore not implemented in lcc-win32 yet.
h Specifies that a following d, i, o, u, x,or X conversion specifier applies to a short int or unsigned short int argument (the argument will have been promoted according to the integer promotions, but its value shall be converted to short int or unsigned short int before printing); or that a following n conversion specifier applies to a pointer to a short int argument.
l (ell) Specifies that a following d, i, o, u, x,or X conversion specifier applies to a long int or unsigned long int argument; that a following n conversion specifier applies to a pointer to a long int argument; that a following c conversion specifier applies to a wint_t argument; that a following s conversion specifier applies to a pointer to a wchar_t argument; or has no effect on a following a, A, e, E, f, F, g,or G conversion specifier.
ll (ell-ell) Specifies that a following d, i, o, u, x,or X conversion specifier applies to a long long int or unsigned long long int argument; or that a following n conversion specifier applies to a pointer to a long long int argument.
Not implemented in CRTDLL.DLL
j Specifies that a following d, i, o, u, x,orXconversion specifier applies to an intmax_t or uintmax_t argument; or that a following n conversion specifier applies to a pointer to an intmax_t argument.
z Specifies that a following d, i, o, u, x,or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument.
NOT IMPLEMENTED IN CRTDLL.DLL
t Specifies that a following d, i, o, u, x,orXconversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument; or that a following n conversion specifier applies to a pointer to a ptrdiff_t argument.
L Specifies that a following a, A, e, E, f, F, g,or G conversion specifier applies to a long double argument.
Not implemented in CRTDLL.DLL
If a length modifier appears with any conversion specifier other than as specified above, the behavior is undefined.
The conversion specifiers and their meanings are:
d,i The int argument is converted to signed decimal in the style [璢dddd. The precision specifies the minimum number of digits to appear; if the value being converted can be represented in fewer digits, it is expanded with leading zeros. The default precision is 1. The result of converting a zero value with a precision of zero is no characters.
o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the letters abcdef are used for x conversion and the letters ABCDEF for Xconversion. The precision specifies the minimum number of digits to appear; if the value being converted can be represented in fewer digits, it is expanded with leading zeros. The default precision is 1. The result of converting a zero value with a precision of zero is no characters.
f,F A double argument representing a (finite) floating-point number is converted to decimal notation in the style [璢ddd.ddd, where the number of digits after the decimal-point character is equal to the precision specification. If the precision is missing, it is taken as 6; if the precision is zero and the # flag is not specified, no decimal-point character appears. If a decimal-point character appears, at least one digit appears before it. The value is rounded to the appropriate number of digits. A double argument representing an infinity is converted in one of the styles [-]inf or [-]infinity — which style is implementation-defined. A double argument representing a NaN is converted in one of the styles [-]nan or [-]nan(n-char-sequence) — which style, and the meaning of
any n-char-sequence, is implementation-defined. The F conversion specifier produces INF, INFINITY,or NAN instead of inf, infinity, or nan, respectively.
e,E A double argument representing a (finite) floating-point number is converted in the style [璢d.ddd e?dd, where there is one digit (which is nonzero if the argument is nonzero) before the decimal-point character and the number of digits after it is equal to the precision; if the precision is missing, it is taken as 6; if the precision is zero and the # flag is not specified, no decimal-point character appears. The value is rounded to the appropriate number of digits. The E conversion specifier produces a number with E instead of e introducing the exponent. The exponent always contains at least two digits, and only as many more digits as necessary to represent the exponent. If the value is zero, the exponent is zero. A double argument representing an infinity or NaN is converted in the style
of an f or F conversion specifier.
g,G A double argument representing a (finite) floating-point number is converted in style f or e (or in style F or E in the case of a G conversion specifier), with the precision specifying the number of significant digits. If the precision is zero, it is taken as 1. The style used depends on the value converted; style e (or E) is used only if the exponent resulting from such a conversion is less than 4 or greater than or equal to the precision. Trailing zeros are removed from the fractional portion of the result unless the # flag is specified; a decimal-point character appears only if it is followed by a digit. A double argument representing an infinity or NaN is converted in the style of an f or F conversion specifier.
a,A A double argument representing a (finite) floating-point number is converted in the style [璢0xh.hhhh p?d, where there is one hexadecimal digit (which is nonzero if the argument is a normalized floating-point number and is otherwise unspecified) before the decimal-point character 219) and the ??number of hexadecimal digits after it is equal to the precision; if the precision is missing and FLT_RADIX is a power of 2, then the precision is sufficient for an exact representation of the value; if the precision is missing and FLT_RADIX is not a power of 2, then the precision is sufficient to distinguish 220) values of type double, except that trailing zeros may be omitted; if the precision is zero and the # flag is not specified, no decimal-point character appears.
The letters abcdef are used for a conversion and the letters ABCDEF for A conversion. The A conversion specifier produces a number with X and P instead of x and p. The exponent always contains at least one digit, and only as many more digits as necessary to represent the decimal exponent of 2. If the value is zero, the exponent is zero.
A double argument representing an infinity or NaN is converted in the style of an f or F conversion specifier.
?????????? NOT implemented in CRTDLL.DLL
c If no l length modifier is present, the int argument is converted to an unsigned char, and the resulting character is written. If an l length modifier is present, the wint_t argument is converted as if by an ls conversion specification with no precision and an argument that points to the initial element of a two-element array of wchar_t, the first element containing the wint_t argument to the lc conversion specification and the second a null wide character.
s If no l length modifier is present, the argument shall be a pointer to the initial element of an array of character type. Characters from the array are written up to (but not including) the terminating null character. If the precision is specified, no more than that many characters are written. If the precision is not specified or is greater than the size of the array, the array shall contain a null character. If an l length modifier is present, the argument shall be a pointer to the initial element of an array of wchar_t type. Wide characters from the array are converted to multibyte characters (each as if by a call to the wcrtomb function, with the conversion state described by an mbstate_t object initialized to zero before the first wide character is converted) up to and including a terminating null wide character. The resulting multibyte characters are written up to (but not including) the terminating null character (byte). If no precision is specified, the array shall contain a null wide character. If a precision is specified, no more than that many characters (bytes) are written (including shift sequences, if any), and the array shall contain a null wide character if, to equal the multibyte character sequence length given by the precision, the function would need to access a wide character one past the end of the array. In no case is a partial multibyte
character written.
p The argument shall be a pointer to void. The value of the pointer is converted to a sequence of printable characters, in an implementation-defined manner.
n The argument shall be a pointer to signed integer into which is written the number of characters written to the output stream so far by this call to fprintf. No argument is converted, but one is consumed. If the conversion specification includes any flags, a field width, or a precision, the behavior is undefined.
% A % character is written. No argument is converted. The complete conversion specification shall be %%.
If a conversion specification is invalid, the behavior is undefined. If any argument is not the correct type for the corresponding coversion specification, the behavior is undefined.
In no case does a nonexistent or small field width cause truncation of a field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result.
For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded to a hexadecimal floating number with the given precision.
For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most DECIMAL_DIG, then the result should be correctly rounded. If the number of significant decimal digits is more than DECIMAL_DIG but the source value is exactly representable with DECIMAL_DIG digits, then the result should be an exact representation with trailing zeros. Otherwise, the source value is bounded by two adjacent decimal strings L
Returns
The fprintf function returns the number of characters transmitted, or a negative value if an output or encoding error occurred.
Environmental limits
The number of characters that can be produced by any single conversion shall be at least 4095.
fputc
Synopsis
#include
int fputc(int c, FILE *stream);
Description
The fputc function writes the character specified by c (converted to an unsigned char) to the output stream pointed to by stream, at the position indicated by the associated file position indicator for the stream (if defined), and advances the indicator appropriately. If the file cannot support positioning requests, or if the stream was opened with append mode, the character is appended to the output stream.
Returns
The fputc function returns the character written. If a write error occurs, the error indicator for the stream is set and fputc returns EOF.
fputs
Synopsis
#include
int fputs(const char * restrict s, FILE * restrict stream);
Description
The fputs function writes the string pointed to by s to the stream pointed to by stream. The terminating null character is not written.
Returns
The fputs function returns EOF if a write error occurs; otherwise it returns a nonnegative value.
fread
Synopsis
#include
size_t fread(void * restrict ptr,size_t size, size_t nmemb,FILE * restrict stream);
Description
The fread function reads, into the array pointed to by ptr,up tonmemb elements whose size is specified by size, from the stream pointed to by stream. The file position indicator for the stream (if defined) is advanced by the number of characters successfully read. If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. If a partial element is read, its value is indeterminate.
Returns
The fread function returns the number of elements successfully read, which may be less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero, fread returns zero and the contents of the array and the state of the stream remain unchanged.
free
Synopsis
#include
void free(void *ptr);
Description
The free function causes the space pointed to by ptr to be deallocated, that is, made available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if the argument does not match a pointer earlier returned by the calloc, malloc,or realloc function, or if the space has been deallocated by a call to free or realloc, the behavior is undefined.
Returns
The free function returns no value.
freopen
Synopsis
#include
FILE *freopen(const char * filename, const char * mode,FILE * restrict stream);
Description
The freopen function opens the file whose name is the string pointed to by filename and associates the stream pointed to by stream with it. The mode argument is used just as in the fopen function.
The primary use of the freopen function is to change the file associated with a standard text stream (stderr, stdin,orstdout), as those identifiers need not be modifiable lvalues to which the value returned by the fopen function may be assigned.
If filename is a null pointer, the freopen function attempts to change the mode of the stream to that specified by mode,as if the name of the file currently associated with the stream had been used. It is implementation-defined which changes of mode are permitted (if any), and under what circumstances.
The freopen function first attempts to close any file that is associated with the specified stream. Failure to close the file is ignored. The error and end-of-file indicators for the stream are cleared.
Returns
The freopen function returns a null pointer if the open operation fails. Otherwise, freopen returns the value of stream.
frexp
Synopsis
1 #include
double frexp(double value, int *exp);
Description
The frexp functions break a floating-point number into a normalized fraction and an integral power of 2. They store the integer in the int object pointed to by exp.
Returns
The frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or zero, and value equals x ??2 *exp .If value is zero, both parts of the result are zero.
fscanf
Synopsis
#include
int fscanf(FILE * restrict stream,const char * restrict format, ...);
Description
The fscanf function reads input from the stream pointed to by stream, under control of the string pointed to by format that specifies the admissible input sequences and how they are to be converted for assignment, using subsequent arguments as pointers to the objects to receive the converted input. If there are insufficient arguments for the format, the behavior is undefined. If the format is exhausted while arguments remain, the excess arguments are evaluated (as always) but are otherwise ignored.
The format shall be a multibyte character sequence, beginning and ending in its initial shift state. The format is composed of zero or more directives: one or more white-space characters, an ordinary multibyte character (neither % nor a white-space character), or a conversion specification. Each conversion specification is introduced by the character %.
After the %, the following appear in sequence:
? An optional assignment-suppressing character *.
? An optional nonzero decimal integer that specifies the maximum field width (in characters).
? An optional length modifier that specifies the size of the receiving object.
? Aconversion specifier character that specifies the type of conversion to be applied.
The fscanf function executes each directive of the format in turn. If a directive fails, as detailed below, the function returns. Failures are described as input failures (due to the occurrence of an encoding error or the unavailability of input characters), or matching failures (due to inappropriate input).
A directive composed of white-space character(s) is executed by reading input up to the first non-white-space character (which remains unread), or until no more characters can be read.
A directive that is an ordinary multibyte character is executed by reading the next characters of the stream. If any of those characters differ from the ones composing the directive, the directive fails and the differing and subsequent characters remain unread.
A directive that is a conversion specification defines a set of matching input sequences, as described below for each specifier. A conversion specification is executed in the
following steps:
Input white-space characters (as specified by the isspace function) are skipped, unless the specification includes a [, c,ornspecifier.225)
An input item is read from the stream, unless the specification includes an n specifier. An input item is defined as the longest sequence of input characters which does not exceed any specified field width and which is, or is a prefix of, a matching input sequence. The first character, if any, after the input item remains unread. If the length of the input item is zero, the execution of the directive fails; this condition is a matching failure unless end-of- file, an encoding error, or a read error prevented input from the stream, in which case it is an input failure.
Except in the case of a % specifier, the input item (or, in the case of a %n directive, the count of input characters) is converted to a type appropriate to the conversion specifier. If the input item is not a matching sequence, the execution of the directive fails: this condition is a matching failure. Unless assignment suppression was indicated by a *, the result of the conversion is placed in the object pointed to by the first argument following the format argument that has not already received a conversion result. If this object does not have an appropriate type, or if the result of the conversion cannot be represented in the object, the behavior is undefined.
The length modifiers and their meanings are the same as those of fprintf.
Returns
The fscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure.
fseek
Synopsis
#include
int fseek(FILE *stream, long int offset, int whence);
Description
The fseek function sets the file position indicator for the stream pointed to by stream. If a read or write error occurs, the error indicator for the stream is set and fseek fails. For a binary stream, the new position, measured in characters from the beginning of the file, is obtained by adding offset to the position specified by whence. The specified position is the beginning of the file if whence is SEEK_SET, the current value of the file position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not meaningfully support fseek calls with a whence value of SEEK_END. For a text stream, either offset shall be zero, or offset shall be a value returned by an earlier successful call to the ftell function on a stream associated with the same file and whence shall be SEEK_SET.
After determining the new position, a successful call to the fseek function undoes any effects of the ungetc function on the stream, clears the end-of-file indicator for the stream, and then establishes the new position. After a successful fseek call, the next operation on an update stream may be either input or output.
Returns
The fseek function returns nonzero only for a request that cannot be satisfied.
fsetpos
Synopsis
#include
int fsetpos(FILE *stream, const fpos_t *pos);
Description
The fsetpos function sets the mbstate_t object (if any) and file position indicator for the stream pointed to by stream according to the value of the object pointed to by pos, which shall be a value obtained from an earlier successful call to the fgetpos function on a stream associated with the same file. If a read or write error occurs, the error indicator for the stream is set and fsetpos fails.
A successful call to the fsetpos function undoes any effects of the ungetc function on the stream, clears the end-of-file indicator for the stream, and then establishes the new parse state and position. After a successful fsetpos call, the next operation on an update stream may be either input or output.
Returns
If successful, the fsetpos function returns zero; on failure, the fsetpos function returns nonzero and stores an implementation-defined positive value in errno.
Lcc-win32/windows sets EINVAL (bad value of stream) or EBADF (invalid file handle)
fscanf
Synopsis
#include
int fscanf(FILE * restrict stream,const char * restrict format, ...);
Description
The fscanf function reads input from the stream pointed to by stream, under control of the string pointed to by format that specifies the admissible input sequences and how they are to be converted for assignment, using subsequent arguments as pointers to the objects to receive the converted input. If there are insufficient arguments for the format,the behavior is undefined. If the format is exhausted while arguments remain, the excess arguments are evaluated (as always) but are otherwise ignored.
For a description of the format arguments see the fprintf function.
_fsopen
Synopsis
#include
FILE *_fsopen(char *filename,char *mode,int shflag);
Description
This function opens a file with file sharing. Its arguments are the same as fopen, but augmented with the shflag, that can be one of :
_SH_COMPAT Sets Compatibility mode for 16-bit applications
_SH_DENYNO Permits read and write access
_SH_DENYRD Denies read access to file
_SH_DENYRW Denies read and write access to file
_SH_DENYWR Denies write access to file
Returns :
A pointer to the FILE structure or NULL, if the operation fails.
Portability :
Windows
_fstat
Synopsis
#include
#include
int _fstat(int handle,struct _stat *buffer);
Description
This function retrieves different information for the indicated file, pointed by the handle argument, and puts it in the indicated buffer, that points to a structure of type _stat.
The fields of this structure indicate :
st_atime Time of last file access.
st_ctime Time of creation of file.
st_dev If a device, handle; otherwise 0.
st_mode Bit mask for file-mode information. The _S_IFCHR bit is set if handle refers to a device. The _S_IFREG bit is set if handle refers to an ordinary file. The read/write bits are set according to the file’s permission mode. _S_IFCHR and other constants are defined in SYS\STAT.H.
st_mtime Time of last modification of file.
st_nlink Always 1 on non-NTFS file systems.
st_rdev If a device, handle; otherwise 0.
st_size Size of the file in bytes.
Returns :
Zero if succesfull, -1 on error. In the later case errno is set to EBADF : bad file handle.
ftell
Synopsis
#include
long int ftell(FILE *stream);
Description
The ftell function obtains the current value of the file position indicator for the stream pointed to by stream. For a binary stream, the value is the number of characters from the beginning of the file. For a text stream, its file position indicator contains unspecified information, usable by the fseek function for returning the file position indicator for the stream to its position at the time of the ftell call; the difference between two such return values is not necessarily a meaningful measure of the number of characters written or read.
Returns
If successful, the ftell function returns the current value of the file position indicator for the stream. On failure, the ftell function returns 1L and stores an implementation-defined positive value in errno.
Lcc-win32 sets EINVAL (bad value of stream) or EBADF (invalid file handle).
_ftime
Synopsis
#include
#include
void ftime(struct _timeb *timeptr);
Description
The _ftile function fills the structure timeb pointed by its argument with information about the current time.
This structure has the following relevant fields :
dstflag Nonzero if daylight savings time is currently in effect for the local time zone.
millitm Fraction of a second in milliseconds.
time Time in seconds since midnight (00:00:00), January 1, 1970, coordinated universal time (UTC).
timezone Difference in minutes, moving westward, between UTC and local time.
Returns :
This function returns no value
fwrite
Synopsis
#include
size_t fwrite(const void * restrict ptr,size_t size, size_t nmemb,FILE * restrict stream);
Description
The fwrite function writes, from the array pointed to by ptr,up to nmemb elements whose size is specified by size, to the stream pointed to by stream. The file position indicator for the stream (if defined) is advanced by the number of characters successfully written. If an error occurs, the resulting value of the file position indicator for the stream is indeterminate.
Returns
The fwrite function returns the number of elements successfully written, which will be less than nmemb only if a write error is encountered.
gcvt
Synopsis
#include
char *_gcvt(double value,int ndigits,char *buf);
Description
Converts a floating-point number to a character string. The value parameter is the floating-point number to be converted. It produces ndigit significant digits in either printf() F format or E format.
_gcvt and _fcvt use a single statically allocated buffer for the conversion. Each call to one of these routines destroys the result of the previous call.
Portability :
Windows / Unix
getc
Synopsis
#include
int getc(FILE *stream);
Description
The getc function is equivalent to fgetc, except that if it is implemented as a macro, it may evaluate stream more than once, so the argument should never be an expression with side effects.
Returns
The getc function returns the next character from the input stream pointed to by stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and getc returns EOF. If a read error occurs, the error indicator for the stream is set and getc returns EOF.
getchar
Synopsis
#include
int getchar(void);
Description
The getchar function is equivalent to getc with the argument stdin.
Returns
The getchar function returns the next character from the input stream pointed to by stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and getchar returns EOF. If a read error occurs, the error indicator for the stream is set and getchar returns EOF.
getcwd
Synopsis
#include
char *getcwd(char *buffer,int maxlen);
Description
The getcwd function writes the current working directory to the buffer indicated by buffer, without exceeding maxlen chars. If buffer is NULL, a freshly allocated buffer is returned using malloc.
If the current working directory is the root, the string ends with a backslash (\). If the current working directory is a directory other than the root, the string ends with the directory name and not with a backslash.
Returns
Returns a pointer to the given buffer.
Portability :
Windows and UNIX
getdcwd
Synopsis
#include
char *getdcwd(int drive, char *buffer,int maxlen);
Description
The getdcwd function writes the current working directory for the specified drive to the buffer indicated by buffer, without exceeding maxlen chars. If buffer is NULL, a freshly allocated buffer is returned using malloc.
If the current working directory is the root, the string ends with a backslash (\). If the current working directory is a directory other than the root, the string ends with the directory name and not with a backslash.
The drive argument can be zero (current drive), 1 (drive A) 2, (drive B), 3 (drive C) etc.
Returns
Returns a pointer to the given buffer.
Portability :
Windows. (There is no drive concept under Unix)
getdrive
Synopsis
#include
int getdrive(void);
Description
The getdrive function returns an integer representing the current drive : 1 for the A drive, 2 for the B drive, 3 for the C drive, etc.
Returns
Returns the number of the current drive
Portability :
Windows
getpid
Synopsis
#include
int _getpid(void);
Description
The getpid function retrieves the current process ID.
Returns
Returns an integer with the current process ID
Portability :
Windows UNIX
getenv
Synopsis
#include
char *getenv(const char *name);
Description
The getenv function searches an environment list, provided by the host environment, for a string that matches the string pointed to by name. The set of environment names and the method for altering the environment list are implementation-defined.
The implementation shall behave as if no library function calls the getenv function.
Returns
The getenv function returns a pointer to a string associated with the matched list member. The string pointed to shall not be modified by the program, but may be overwritten by a subsequent call to the getenv function. If the specified name cannot be found, a null pointer is returned.
gets
Synopsis
#include
char *gets(char *s);
Description
The gets function reads characters from the input stream pointed to by stdin, into the array pointed to by s, until end-of-file is encountered or a new-line character is read. Any new-line character is discarded, and a null character is written immediately after the last character read into the array.
Returns
The gets function returns s if successful. If end-of-file is encountered and no characters have been read into the array, the contents of the array remain unchanged and a null pointer is returned. If a read error occurs during the operation, the array contents are indeterminate and a null pointer is returned.
gmtime
Synopsis
#include
struct tm *gmtime(const time_t *timer);
Description
The gmtime function converts the calendar time pointed to by timer into a broken-down time, expressed as UTC.
Returns
The gmtime function returns a pointer to the broken-down time, or a null pointer if the specified time cannot be converted to UTC.
heapchk
Synopsis
#include
int _heapchk(void);
Description
The _heapchk function tests whether the heap is consistent.
Returns
_heapchk returns one of the following integer manifest constants defined in MALLOC.H:
_HEAPBADBEGIN Initial header information is bad or cannot be found
_HEAPBADNODE Bad node has been found or heap is damaged
_HEAPBADPTR Pointer into heap is not valid
_HEAPEMPTY Heap has not been initialized
_HEAPOK Heap appears to be consistent
In addition, if an error occurs, _heapchk sets errno to ENOSYS.
Portability :
Windows
heapmin
Synopsis
#include
int _heamin(void);
Description
The _heapmin function releases unused memory in the heap.
Returns
Zero on success, -1 otherwise
Portability :
THIS FUNCTION WILL ONLY WORK UNDER WINDOWS NT. It will return -1 if called from another windows platform.
heapset
Synopsis
#include
int _heapset(int fill);
Description
The _heapset function sets all unused memory locations in the heap to the given value. This helps detect data that was written to a heap block that was already freed.
Returns
_heapset returns one of the following integer manifest constants defined in MALLOC.H:
_HEAPBADBEGIN Initial header information invalid or not found
_HEAPBADNODE Heap damaged or bad node found
_HEAPEMPTY Heap not initialized
_HEAPOK Heap appears to be consistent
In addition, if an error occurs, _heapset sets errno to ENOSYS
Portability
THIS FUNCTION WILL WORK ONLY UNDER WINDOWS NT. It will fail in all other windows platforms.
hypot
Synopsis
#include
double hypot(double x, double y);
Description
The hypot functions compute the square root of the sum of the squares of x and y, without undue overflow or underflow. A range error may occur.
To maintain compatibility with Microsoft’s compilers, lcc-win32 defines _hypot as an alternative equivalent name for hypot.
Returns
The hypot functions return the value of the square root of the sum of the squares.
Example :
#include
#include
void main( void )
{
double x = 6.0, y = 4.0;
printf( "If a right triangle has sides %2.1f and %2.1f, "
"its hypotenuse is %2.1f\n", x, y, hypot( x, y ) );
}
Output :
If a right triangle has sides 6.0 and 4.0, its hypotenuse is 7.2
isalnum iswalnum
Synopsis
#include
int isalnum(int c);
int iswalnum(wint_t c) ;
Description
The isalnum function tests for any character for which isalpha or isdigit is true.
isalpha
Synopsis
#include
int isalpha(int c);
Description
The isalpha function tests for any character for which isupper or islower is true, or any character that is one of a locale-specific set of alphabetic characters for which none of iscntrl, isdigit, ispunct,orisspace is true. In the "C" locale, isalpha returns true only for the characters for which isupper or islower is true.
isatty
Synopsis
#include
int _isatty(int handle);
Description
This function tests whether the given file handle is a character device (a console, a printer or a serial port).
Returns :
Non zero if the file handle is associated with a character device, zero otherwise.
Portability :
Windows UNIX
iscntrl
Synopsis
#include
int iscntrl(int c);
Description
The iscntrl function tests for any control character.
isdigit
Synopsis
#include
int isdigit(int c);
Description
The isdigit function tests for any decimal-digit character , i.e. characters between 0 and 9 inclusive.
isgraph
Synopsis
#include
int isgraph(int c);
Description
The isgraph function tests for any printing character except space (’ ’).
islower
Synopsis
#include
int islower(int c);
Description
The islower function tests for any character that is a lowercase letter or is one of a locale-specific set of characters for which none of iscntrl, isdigit, ispunct,or isspace is true. In the "C" locale, islower returns true only for the characters defined as lowercase letters
iso646.h
The header defines the following eleven macros
#define and &&
#define and_eq &=
#define bitand &
#define bitor |
#define compl ~
#define not !
#define not_eq !=
#define or ||
#define or_eq |=
#define xor ^
#define xor_eq ^=
isprint
Synopsis
#include
int isprint(int c);
Description
The isprint function tests for any printing character including space (’ ’).
ispunct
Synopsis
#include
int ispunct(int c);
Description
The ispunct function tests for any printing character that is one of a locale-specific set of punctuation characters for which neither isspace nor isalnum is true.
isspace
Synopsis
#include
int isspace(int c);
Description
The isspace function tests for any character that is a standard white-space character or is one of a locale-specific set of characters for which isalnum is false. The standard white-space characters are the following: space (’ ’), form feed (’\f’), new-line (’\n’), carriage return (’\r’), horizontal tab (’\t’), and vertical tab (’\v’). In the "C" locale, isspace returns true only for the standard white-space characters.
isupper
Synopsis
#include
int isupper(int c);
Description
The isupper function tests for any character that is an uppercase letter or is one of a locale-specific set of characters for which none of iscntrl, isdigit, ispunct,or isspace is true. In the "C" locale, isupper returns true only for the characters defined as uppercase letters.
itoa
Synopsis
#include
int itoa(int value, char *string, int radix);
Description
The _itoa function converts the digits of the given value argument to a null-terminated character string and stores the result (up to 17 bytes) in string. If radix equals 10 and value is negative, the first character of the stored string is the minus sign ( – )
Returns :
Returns a pointer to the given string.
Portability :
Windows
_j0,_ j1,_ jn
Synopsis :
#include
double _j0(double x) ;
double _j1(double x) ;
double _jn(int n,double x) ;
Description :
This functions compute the Bessel functions of the first kind for their arguments, orders 0, 1, and N respectively.
Returns :
Returns the bessel function value
isxdigit
Synopsis
#include
int isxdigit(int c);
Description
The isxdigit function tests for any hexadecimal-digit character.
_kbhit
Synopsis
#include
int _kbhit(void) ;
Description
This routine returns non zero if a key has been pressed, zero otherwise.
Returns
Non zero : Keyboard has been hit, zero, the user didn’t touch the keyboard.
Portability :
Strictly windows function.
ldexp
Synopsis
#include
double ldexp(double x, int exp);
Description
The ldexp functions multiply a floating-point number by an integral power of 2. A range error may occur.
Returns
The ldexp functions return the value of x ??2 exp .
Example :
#include
#include
void main( void )
{
double x = 3.0, y;
int p = 4;
y = ldexp( x, p );
printf( "%2.1f times two to the power of %d is %2.1f\n", x, p, y );
}
3.0 times two to the power of 4 is 48.0
localeconv
Synopsis
#include
struct lconv *localeconv(void);
Description
The localeconv function sets the components of an object with type struct lconv with values appropriate for the formatting of numeric quantities (monetary and otherwise) according to the rules of the current locale.
The members of the structure with type char * are pointers to strings, any of which (except decimal_point) can point to "", to indicate that the value is not available in the current locale or is of zero length. Apart from grouping and mon_grouping, the strings shall start and end in the initial shift state. The members with type char are nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not available in the current locale. The members include the following:
? char *decimal_point The decimal-point character used to format nonmonetary quantities.
? char *thousands_sep The character used to separate groups of digits before the decimal-point character in formatted nonmonetary quantities.
? char *grouping A string whose elements indicate the size of each group of digits in formatted nonmonetary quantities. ?
? char *mon_decimal_point The decimal-point used to format monetary quantities.
? char *mon_thousands_sep The separator for groups of digits before the decimal-point in formatted monetary quantities.
? char *mon_grouping A string whose elements indicate the size of each group of digits in formatted monetary quantities.
? char *positive_sign The string used to indicate a nonnegative-valued formatted monetary quantity.
? char *negative_sign The string used to indicate a negative-valued formatted monetary quantity.
? char *currency_symbol The local currency symbol applicable to the current locale.
? char frac_digits The number of fractional digits (those after the decimal-point) to be displayed in a locally formatted monetary quantity.
? char p_cs_precedes Set to 1 or 0 if the currency_symbol respectively precedes or succeeds the value for a nonnegative locally formatted monetary quantity.
? char n_cs_precedes Set to 1 or 0 if the currency_symbol respectively precedes or succeeds the value for a negative locally formatted monetary quantity.
? char p_sep_by_space Set to a value indicating the separation of the currency_symbol,the sign string, and the value for a nonnegative locally formatted monetary quantity.
? char n_sep_by_space Set to a value indicating the separation of the currency_symbol,the sign string, and the value for a negative locally formatted monetary quantity.
? char p_sign_posn Set to a value indicating the positioning of the positive_sign for a nonnegative locally formatted monetary quantity.
? char n_sign_posn Set to a value indicating the positioning of the negative_sign for a negative locally formatted monetary quantity.
? char *int_curr_symbol The international currency symbol applicable to the current locale. The first three characters contain the alphabetic international currency symbol in accordance with those specified in ISO 4217:1995. The fourth character(immediately preceding the null character) is the character used to separate the international currency symbol from the monetary quantity.
? char int_frac_digits The number of fractional digits (those after the decimal-point) to be displayed in an internationally formatted monetary quantity.
? char int_p_cs_precedes Set to 1 or 0 if the int_currency_symbol respectively precedes or succeeds the value for a nonnegative internationally formatted monetary quantity.
? char int_n_cs_precedes Set to 1 or 0 if the int_currency_symbol respectively precedes or succeeds the value for a negative internationally formatted monetary quantity.
? char int_p_sep_by_space Set to a value indicating the separation of the int_currency_symbol,the sign string, and the value for a nonnegative internationally formatted monetary quantity.
? char int_n_sep_by_space Set to a value indicating the separation of the int_currency_symbol,the sign string, and the value for a negative internationally formatted monetary quantity.
? char int_p_sign_posn Set to a value indicating the positioning of the positive_sign for a nonnegative internationally formatted monetary quantity.
? char int_n_sign_posn Set to a value indicating the positioning of the negative_sign for a negative internationally formatted monetary quantity.
The elements of grouping and mon_grouping are interpreted according to the following:
CHAR_MAX No further grouping is to be performed.
0 The previous element is to be repeatedly used for the remainder of the digits.
other The integer value is the number of digits that compose the current group.
The next element is examined to determine the size of the next group of digits before the current group.
The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space, and int_n_sep_by_space are interpreted according to the following:
0 No space separates the currency symbol and value.
1 A space separates the currency symbol and value.
2 A space separates the currency symbol and the sign string, if adjacent.
The values of p_sign_posn, n_sign_posn, int_p_sign_posn,and int_n_sign_posn are interpreted according to the following:
0 Parentheses surround the quantity and currency symbol.
1 The sign string precedes the quantity and currency symbol.
2 The sign string succeeds the quantity and currency symbol.
3 The sign string immediately precedes the currency symbol.
4 The sign string immediately succeeds the currency symbol.
7 The implementation shall behave as if no library function calls the localeconv function.
Returns
The localeconv function returns a pointer to the filled-in object. The structure pointed to by the return value shall not be modified by the program, but may be overwritten by a subsequent call to the localeconv function. In addition, calls to the setlocale function with categories LC_ALL, LC_MONETARY,orLC_NUMERIC may overwrite the contents of the structure.
localtime
Synopsis
#include
struct tm *localtime(const time_t *timer);
Description
The localtime function converts the calendar time pointed to by timer into a broken-down time, expressed as local time.
Returns
The localtime function returns a pointer to the broken-down time, or a null pointer if the specified time cannot be converted to local time.
log
Synopsis
#include
double log(double x);
Description
The log function compute the base-e (natural) logarithm of x. A domain error occurs if the argument is negative. A range error may occur if the argument is zero.
Returns
The log function return the base-e logarithm value.
Example :
#include
#include
void main( void )
{
double x = 9000.0;
double y;
y = log( x );
printf( "log( %.2f ) = %f\n", x, y );
y = log10( x );
printf( "log10( %.2f ) = %f\n", x, y );
}
log( 6000.00 ) = 8.699515
log10( 6000.00 ) = 3.778151
log10
Synopsis
#include
double log10(double x);
Description
The log10 function computes the base-10 (common) logarithm of x. A domain error occurs if the argument is negative. A range error may occur if the argument is zero.
Returns
The log10 functions return the base-10 logarithm value.
Example :
#include
#include
void main( void )
{
double x = 9000.0;
double y;
y = log( x );
printf( "log( %.2f ) = %f\n", x, y );
y = log10( x );
printf( "log10( %.2f ) = %f\n", x, y );
}
log( 6000.00 ) = 8.699515
log10( 6000.00 ) = 3.778151
longjmp
Synopsis
#include
void longjmp(jmp_buf env, int val);
Description
The longjmp function restores the environment saved by the most recent invocation of the setjmp macro in the same invocation of the program with the corresponding jmp_buf argument. If there has been no such invocation, or if the function containing the invocation of the setjmp macro has terminated execution 195) in the interim, or if the invocation of the setjmp macro was within the scope of an identifier with variably modified type and execution has left that scope in the interim, the behavior is undefined.
All accessible objects have values as of the time longjmp was called, except that the values of objects of automatic storage duration that are local to the function containing the invocation of the corresponding setjmp macro that do not have volatile-qualified type and have been changed between the setjmp invocation and longjmp call are indeterminate.
Returns
After longjmp is completed, program execution continues as if the corresponding invocation of the setjmp macro had just returned the value specified by val. The longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,the setjmp macro returns the value 1.
malloc
Synopsis
#include
void *malloc(size_t size);
Description
The malloc function allocates space for an object whose size is specified by size and whose value is indeterminate.
Returns
The malloc function returns either a null pointer or a pointer to the allocated space.
Under lcc-win32, the following functions and their wide-character counterparts can also call malloc:
calloc fscanf _getw setvbuf _exec functions fseek _popen _spawn functions fgetc fsetpos printf _strdup _fgetchar _fullpath putc system fgets fwrite putchar _tempnam fprintf getc _putenv ungetc fputc getchar puts vfprintf _fputchar _getcwd _putw vprintf fputs _getdcwd scanf fread gets _searchenv
makepath
Synopsis
#include
void makepath(char *path,const char *drive,const char *dir,const char *fname,const char *ext) ;
Description
The makepath function creates a single path from its arguments and stores it in the path argument. The arguments are :
? drive : Contains a letter corresponding to the desired drive and an optional trailing colon. If null, no drive letter and colon appear in the result.
? dir : Contains the specification of a directory. The trailing path is optional, and both forward and backward slashes can be used.
? fname : Contains the file name without any path or drive components.
? ext : contains the extension without the period.
The result is stored in the path argument, that should be no longuer than MAX_PATH, defined in stdlib.h
Returns :
The _makepath function returns no value.
Portability :
Windows
_mbbtombc
Synopsis
#include
unsigned short mbbtombc(unsigned short c) ;
Description
The mbbtombc function converts a given single-byte multibyte character to a corresponding double-byte multibyte character. Characters must be within the range 0x20 – 0x7E or 0xA1 – 0xDF to be converted.
Returns :
If successful, it returns a multi byte character. Otherwise it returns c.
_mbbtype
Synopsis
#include
#include
int mbbtype(unsigned char c,int type) ;
Description
The mbbtype function returns the type of byte within a string. This decision is context-sensitive as specified by the value of type, which provides the control test condition. type is the type of the previous byte in the string.The manifest constants in the following table are defined in MBCTYPE.H.
Returns :
If successful, it returns a multi byte character. Otherwise it returns c.
_mbccpy
Synopsis
#include
void _mbccpy(unsigned char * s1,unsigned char * s2);
Description
The strcpy function copies the multibyte string pointed to by s2 (including the terminating null character) into the array pointed to by s1. If the s1 argument doesn’t point to the lead byte of a multiple character no copy is performed.
Returns
The mbccpy function returns no value
Portability :
Windows
mblen
#include
int mblen(const char *s, size_t n);
Description
If sis not a null pointer, the mblen function determines the number of bytes contained in the multibyte character pointed to by s. Except that the shift state of the mbtowc function is not affected, it is equivalent to mbtowc((wchar_t *)0, s, n);
The implementation shall behave as if no library function calls the mblen function.
Returns
If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte character encodings, respectively, do or do not have state-dependent encodings. If s is not a null pointer, the mblen function either returns 0 (if s points to the null character), or returns the number of bytes that are contained in the multibyte character (if the next n or fewer bytes form a valid multibyte character), or returns 1 (if they do not form a valid multibyte character).
mbstowcs
Synopsis
#include
size_t mbstowcs(wchar_t * restrict pwcs,const char * restrict s,size_t n);
Description
The mbstowcs function converts a sequence of multibyte characters that begins in the initial shift state from the array pointed to by s into a sequence of corresponding codes and stores not more than n codes into the array pointed to by pwcs. No multibyte characters that follow a null character (which is converted into a code with value zero) will be examined or converted. Each multibyte character is converted as if by a call to the mbtowc function, except that the shift state of the mbtowc function is not affected.
No more than n elements will be modified in the array pointed to by pwcs. If copying takes place between objects that overlap, the behavior is undefined.
Returns
If an invalid multibyte character is encountered, the mbstowcs function returns (size_t)-1. Otherwise, the mbstowcs function returns the number of array elements modified, not including a terminating zero code, if any.
mbtowc
Synopsis
#include
int mbtowc(wchar_t * restrict pwc, const char * restrict s,
size_t n);
Description
If s is not a null pointer, the mbtowc function determines the number of bytes that are contained in the multibyte character pointed to by s. It then determines the code for the value of type wchar_t that corresponds to that multibyte character. (The value of the code corresponding to the null character is zero.) If the multibyte character is valid and pwc is not a null pointer, the mbtowc function stores the code in the object pointed to by pwc. At most n bytes of the array pointed to by s will be examined. The implementation shall behave as if no library function calls the mbtowc function.
Returns
If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte character encodings, respectively, do or do not have state-dependent encodings. If s is not a null pointer, the mbtowc function either returns 0 (if s points to the null character), or returns the number of bytes that are contained in the converted multibyte character (if the next n or fewer bytes form a valid multibyte character), or returns 1 (if they do not form a valid multibyte character).
In no case will the value returned be greater than n or the value of the MB_CUR_MAX macro.
memchr
Synopsis
#include
void *memchr(const void *s, int c, size_t n);
Description
The memchr function locates the first occurrence of c (converted to an unsigned char) in the initial n characters (each interpreted as unsigned char) of the object pointed to by s.
Returns
The memchr function returns a pointer to the located character, or a null pointer if the character does not occur in the object.
memcmp
Synopsis
#include
int memcmp(const void *s1, const void *s2, size_t n);
Description
The memcmp function compares the first n characters of the object pointed to by s1 to the first n characters of the object pointed to by s2.
Returns
The memcmp function returns an integer greater than, equal to, or less than zero, accordingly as the object pointed to by s1 is greater than, equal to, or less than the object pointed to by s2.
memcpy
Synopsis
#include
void *memcpy(void * restrict s1, const void * restrict s2,
size_t n);
Description
The memcpy function copies n characters from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.
Returns
The memcpy function returns the value of s1.
memmove
Synopsis
#include
void *memmove(void *s1, const void *s2, size_t n);
Description
The memmove function copies n characters from the object pointed to by s2 into the object pointed to by s1. Copying takes place as if the n characters from the object pointed to by s2 are first copied into a temporary array of n characters that does not overlap the objects pointed to by s1 and s2, and then the n characters from the temporary array are copied into the object pointed to by s1.
Returns
The memmove function returns the value of s1.
memset
Synopsis
#include
void *memset(void *s, int c, size_t n);
Description
The memset function copies the value of c (converted to an unsigned char) into each of the first n characters of the object pointed to by s.
Returns
The memset function returns the value of s.
modf
Synopsis
#include
double modf(double value, double *iptr);
Description
The modf function breaks the argument value into integral and fractional parts, each of which has the same type and sign as the argument. It stores the integral part (in floating-point format) in the object pointed to by iptr.
Returns
The modf functions return the value of the signed fractional part of value.
Example :
/* MODF.C */
#include
#include
void main( void )
{
double x, y, n;
x = -23.97766553; /* Divide x into its fractional */
y = modf( x, &n ); /* and integer parts */
printf( "For %f, the fraction is %f and the integer is %.f\n",
x, y, n );
}
Output
For -23.977666, the fraction is -0.977666 and the integer is -23
mktime
Synopsis
#include
time_t mktime(struct tm *timeptr);
Description
The mktime function converts the broken-down time, expressed as local time, in the structure pointed to by timeptr into a calendar time value with the same encoding as that of the values returned by the time function. The original values of the tm_wday and tm_yday components of the structure are ignored, and the original values of the other components are not restricted to the ranges indicated above. On successful completion, the values of the tm_wday and tm_yday components of the structure are set appropriately, and the other components are set to represent the specified calendar time, but with their values forced to the ranges indicated above; the final value of tm_mday is not set until tm_mon and tm_year are determined.
If the call is successful, a second call to the mktime function with the resulting struct tm value shall always leave it unchanged and return the same value as the first call. Furthermore, if the normalized time is exactly representable as a time_t value, then the normalized broken-down time and the broken-down time generated by converting the result of the mktime function by a call to localtime shall be identical.
Returns
The mktime function returns the specified calendar time encoded as a value of type time_t. If the calendar time cannot be represented, the function returns the value (time_t)-1.
modf
Synopsis
#include
double modf(double value, double *iptr);
Description
The modf function breaks the argument value into integral and fractional parts, each of which has the same type and sign as the argument. They store the integral part (in floating-point format) in the object pointed to by iptr.
Returns
The modf functions return the value of the signed fractional part of value.
_open
Synopsis
#include
int _open(const char *filename,int oflag,[int pmode]) ;
Description
The open function returns a file handle for the opened file. A return value of –1 indicates an error, in which case errno is set to one of the following values:
EACCES Tried to open read-only file for writing, or file’s sharing mode does not allow specified operations, or given path is directory
EEXIST _O_CREAT and _O_EXCL flags specified, but filename already exists
EINVAL Invalid oflag or pmode argument
EMFILE No more file handles available (too many open files)
ENOENT File or path not found
oflag is an integer expression formed from one or more of the following manifest constants or constant combinations defined in FCNTL.H:
_O_APPEND Moves file pointer to end of file before every write operation.
_O_BINARY Opens file in binary (untranslated) mode. (See fopen for a description of binary mode.)
_O_CREAT Creates and opens new file for writing. Has no effect if file specified by filename exists. pmode argument is required when _O_CREAT is specified.
_O_CREAT | _O_SHORT_LIVED Create file as temporary and if possible do not flush to disk. pmode argument is required when _O_CREAT is specified.
_O_CREAT | _O_TEMPORARY Create file as temporary; file is deleted when last file handle is closed. pmode argument is required when _O_CREAT is specified.
_O_CREAT | _O_EXCL Returns error value if file specified by filename exists. Applies only when used with _O_CREAT.
_O_RANDOM Specifies primarily random access from disk
_O_RDONLY Opens file for reading only;
_O_RDWR Opens file for both reading and writing;
_O_SEQUENTIAL Specifies primarily sequential access from disk
_O_TEXT Opens file in text (translated) mode.
_O_TRUNC Opens file and truncates it to zero length; file must have write permission. Used with _O_CREAT opens an existing file or creates a new file.
_O_WRONLY Opens file for writing only;
The pmode argument is required only when _O_CREAT is specified. If the file already exists, pmode is ignored. Otherwise, pmode specifies the file permission settings, which are set when the new file is closed the first time. _open applies the current file-permission mask to pmode before setting the permissions (for more information, see _umask). pmode is an integer expression containing one or both of the following manifest constants, defined in SYS\STAT.H:
_S_IREAD Reading only permitted
_S_IWRITE Writing permitted (effectively permits reading and writing)
_S_IREAD | _S_IWRITE Reading and writing permitted
When both constants are given, they are joined with the bitwise-OR operator ( | ). In Windows NT, all files are readable, so write-only permission is not available; thus the modes _S_IWRITE and _S_IREAD | _S_IWRITE are equivalent.
Returns
An integer representing a handle to the open file, or -1 if the operation fails.
_open_osfhandle
Synopsis
#include
int _open_osfhandle(long osfhandle,int flags) ;
Description
The _open_osfhandle function associates a C run time handle with an existing operating system handle as given by the windows function CreateFile. The argument can be one of the flags in fcntl.h :
_O_APPEND
_O_RDONLY
_O_TEXT
Returns
The _open_osfhandle function returns a file handle usable by the low level i/o functions (read/write) or -1 in case of failure.
Portability :
Windows
_pclose
Synopsis
#include
int _pclose(FILE *stream);
Description
The _pclose function looks up the process ID of the command processor (CMD.EXE) started by the associated _popen call, executes a _cwait call on the new command processor, and closes the stream on the associated pipe.
Returns
The _pclose function returns the exit status of the terminating command processor, or –1 if an error occurs. The format of the return value is the same as that for _cwait, except the low-order and high-order bytes are swapped.
perror
Synopsis
#include
void perror(const char *s);
Description
The perror function maps the error number in the integer expression errno to an error message. It writes a sequence of characters to the standard error stream thus: first (if s is not a null pointer and the character pointed to by s is not the null character), the string pointed to by s followed by a colon (:) and a space; then an appropriate error message string followed by a new-line character. The contents of the error message strings are the same as those returned by the strerror function with argument errno.
Returns
The perror function returns no value.
_pipe
Synopsis
#include
#include
int _pipe(int *phandles, unsigned int psize, int textmode);
Description
The _pipe function creates a pipe.
_pipe is similar to _open but opens the pipe for reading and writing, returning two file handles instead of one. The program can use both sides of the pipe or close the one it does not need. For example, the command processor creates a pipe when executing a command such as
type myfile | grep someword
The standard output handle of the type program is attached to the pipe’s write handle. The standard input handle of grep is attached to the pipe’s read handle. This eliminates the need for creating temporary files to pass information to other programs.
The _pipe function returns two handles to the pipe in the phandles argument. The element phandles[0] contains the read handle, and the element phandles[1] contains the write handle. Pipe file handles are used in the same way as other file handles. (The low-level input and output functions _read and _write can read from and write to a pipe.) To detect the end-of-pipe condition, check for a _read request that returns 0 as the number of bytes read.
The psize argument specifies the amount of memory, in bytes, to reserve for the pipe. The textmode argument specifies the translation mode for the pipe. The manifest constant _O_TEXT specifies a text translation, and the constant _O_BINARY specifies binary translation. If the textmode argument is 0, _pipe uses the default translation mode specified by the default-mode variable _fmode.
In multithreaded programs, no locking is performed. The handles returned are newly opened and should not be referenced by any thread until after the _pipe call is complete.
Under windows a pipe is destroyed when all of its handles have been closed. (If all read handles on the pipe have been closed, writing to the pipe causes an error.) All read and write operations on the pipe wait until there is enough data or enough buffer space to complete the I/O request
Returns
Returns 0 if successful. It returns –1 to indicate an error, in which case errno is set to one of two values: EMFILE, which indicates no more file handles available, or ENFILE, which indicates a system file table overflow.
_popen
Synopsis
#include
FILE *popen(const char *command,const char *mode);
Description
The _popen function creates a pipe and asynchronously executes a spawned copy of the command processor with the specified string command. The character string mode specifies the type of access requested:
? "r" The calling process can read the spawned command’s standard output via the result of _popen.
? "w" The calling process can write to the spawned command’s standard input via the result of _popen.
? "b" Open in binary mode.
? "t" Open in text mode.
Returns
Returns the communication stream or NULL if an error occurs.
Portability :
A similar function exists under the LINUX operating system. (without the leading underscore)
pow
Synopsis
#include
double pow(double x, double y);
Description
The pow functions compute x raised to the power y. A domain error occurs if x is negative and y is finite and not an integer value. A domain error occurs if the result cannot be represented when x is zero and y is less than or equal to zero. A range error may occur.
Returns
The pow functions return the value of x raised to the power y.
Example :
#include
#include
void main( void )
{
double x = 2.0, y = 32.0, z;
z = pow( x, y );
printf( "%.1f to the power of %.1f is %.1f\n", x, y, z );
}
Output :
2.0 to the power of 32.0 is 4294967296.0
printf
Synopsis
#include
int printf(const char * restrict format, ...);
Description
The printf function is equivalent to fprintf with the argument stdout interposed
before the arguments to printf.
Returns
The printf function returns the number of characters transmitted, or a negative value if an output or encoding error occurred.
putc
Synopsis
#include
int putc(int c, FILE *stream);
Description
The putc function is equivalent to fputc, except that if it is implemented as a macro, it may evaluate stream more than once, so that argument should never be an expression with side effects.
Returns
The putc function returns the character written. If a write error occurs, the error indicator for the stream is set and putc returns EOF.
putchar
Synopsis
#include
int putchar(int c);
Description
The putchar function is equivalent to putc with the second argument stdout.
Returns
The putchar function returns the character written. If a write error occurs, the error indicator for the stream is set and putchar returns EOF.
putenv
Synopsis
#include
int putenv(const char *envstring);
Description
The putenv function adds new environment variables or modifies the value of existing ones. The envstring argument must be a pointer to a string of the form varname=string, where varname is the name of the environment variable to be added or modified and string is the variable’s value. If varname is already part of the environment, its value is replaced by string; otherwise, the new varname variable and its string value are added to the environment. You can remove a variable from the environment by specifying an empty string — in other words, by specifying only varname=.
Returns
The putenv function returns 0 if successfull, -1 otherwise
puts
Synopsis
#include
int puts(const char *s);
Description
The puts function writes the string pointed to by s to the stream pointed to by stdout,
and appends a new-line character to the output. The terminating null character is not written.
Returns
The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
value.
qsort
Synopsis
#include
void qsort(void *base, size_t nmemb, size_t size,int (*compar)(const void *, const void *));
Description
The qsort function sorts an array of nmemb objects, the initial element of which is pointed to by base. The size of each object is specified by size. The contents of the array are sorted into ascending order according to a comparison function pointed to by compar, which is called with two arguments that point to the objects being compared. The function shall return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
If two elements compare as equal, their order in the resulting sorted array is unspecified.
raise
Synopsis
#include
int raise(int sig);
Description
The raise function carries out the actions described in 7.14.1.1 for the signal sig.If a signal handler is called, the raise function shall not return until after the signal handler does.
Returns
The raise function returns zero if successful, nonzero if unsuccessful.
rand
Synopsis
#include
int rand(void);
Description
The rand function computes a sequence of pseudo-random integers in the range 0 to RAND_MAX.
The implementation shall behave as if no library function calls the rand function.
Returns
The rand function returns a pseudo-random integer.
realloc
Synopsis
#include
void *realloc(void *ptr, size_t size);
Description
The realloc function changes the size of the object pointed to by ptr to the size specified by size. The contents of the object shall be unchanged up to the lesser of the new and old sizes. If the new size is larger, the value of the newly allocated portion of the object is indeterminate. If ptr is a null pointer, the realloc function behaves like the malloc function for the specified size. Otherwise, if ptr does not match a pointer earlier returned by the calloc, malloc,orrealloc function, or if the space has been deallocated by a call to the free or realloc function, the behavior is undefined. If the space cannot be allocated, the object pointed to by ptr is unchanged. If the realloc function returns a null pointer when size is zero and ptr is not a null pointer, the object it pointed to has been freed.
Returns
The realloc function returns either a null pointer or a pointer to the possibly moved allocated space. If the object has moved, ptr is a pointer that refers to freed space.
remove
Synopsis
#include
int remove(const char *filename);
Description
The remove function causes the file whose name is the string pointed to by filename to be no longer accessible by that name. A subsequent attempt to open that file using that name will fail, unless it is created anew. If the file is open, the behavior of the remove function is implementation-defined.
Returns
The remove function returns zero if the operation succeeds, nonzero if it fails. The error codes are : EACCESS (read only file) or ENOENT (no such a file).
Example :
#include
void main( void )
{
if( remove( "remove.obj" ) == -1 )
perror( "Could not delete 'REMOVE.OBJ'" );
else
printf( "Deleted 'REMOVE.OBJ'\n" );
}
rename
Synopsis
#include
int rename(const char *old, const char *new);
Description
The rename function causes the file whose name is the string pointed to by old to be henceforth known by the name given by the string pointed to by new. The file named old is no longer accessible by that name. If a file named by the string pointed to by new exists prior to the call to the rename function, the behavior is implementation-defined.
Returns
The rename function returns zero if the operation succeeds, nonzero if it fails in which case if the file existed previously it is still known by its original name.
rewind
Synopsis
#include
void rewind(FILE *stream);
Description
The rewind function sets the file position indicator for the stream pointed to by stream to the beginning of the file. It is equivalent to
(void)fseek(stream, 0L, SEEK_SET)
except that the error indicator for the stream is also cleared.
Returns
The rewind function returns no value.
rint
Synopsis
#include
double rint(double x);
Description
The rint function round its argument to an integer value in floating-point format, using the current rounding direction. Under lcc-win32 this function is implemented as an intrinsic macro.
Returns
The rint functions returns the rounded integer value.
Example :
#include
#include
void main(void)
{
double value = 8.677;
printf("The rounded value of %g is %d\n",value,rint(value));
}
The rounded value of 8.677 is 9
rmdir
Synopsis
#include
int rmdir(const char * directoryName);
Description
This function deletes the indicated directory. In case of error, the values of errno can be one of :
ENOTEMPTY Directory wasn’t empty
ENOENT Path doesn’t point to an existing directory.
Returns
Zero for success, -1 for failure.
Portability :
Windows
Lcc-win32 supports both the _rmdir and the rmdir functions, that point to the same function in CRTDLL.DLL.
_rmtmp
Synopsis :
#include
int __rmtmp(void) ;
Description :
Removes all temporary files created by the program. This function is not a standard ANSI C function.
Returns :
Returns the number of temporary files deleted
Example :
#include
void main( void )
{
FILE *stream;
int i;
/* Create temporary files. */
for( i = 1; i <= 4; i++ )
{
if( (stream = tmpfile()) == NULL ) {
perror( "Could not open new temporary file\n" );
break;
}
else
printf( "Temporary file %d was created\n", i );
}
/* Remove temporary files. */
printf( "%d temporary files deleted\n", _rmtmp() );
}
_rotl
Synopsis :
#include
unsigned int rotl(unsigned int value,int shift) ;
Description :
Rotates left the bits in the unsigned int by the amount indicated by
Returns :
Returns the rotated value
_rotr
Synopsis :
#include
unsigned int rotr(unsigned int value,int shift) ;
Description :
Rotates right the bits in the unsigned int by the amount indicated by
Returns :
Returns the rotated value
scanf
Synopsis
#include
int scanf(const char * restrict format, ...);
Description
The scanf function is equivalent to fscanf with the argument stdin interposed before the arguments to scanf.
Returns
The scanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the scanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure.
_searchenv
Synopsis :
#include
void_searchenv(const char *filename,const char *varname,char *pathname) ;
Description :
The _searchenv routine searches for the target file specified by its argument in the specified domain. The varname variable can be any environment or user-defined variable that specifies a list of directory paths, such as PATH, LIB, and INCLUDE._searchenv is case sensitive, so varname should match the case of the environment variable.
The routine searches first for the file in the current working directory. If it does not find the file, it looks next through the directories specified by the environment variable. If the target file is in one of those directories, the newly created path is copied into pathname.buffer If the filename file is not found, pathname will contain an empty string.
Returns :
This function returns no value
Portability :
Windows
setbuf
Synopsis
#include
void setbuf(FILE * restrict stream,
char * restrict buf);
Description
Except that it returns no value, the setbuf function is equivalent to the setvbuf function invoked with the values _IOFBF for mode and BUFSIZ for size,or (if buf is a null pointer), with the value _IONBF for mode.
Returns
The setbuf function returns no value.
setmode
Synopsis
#include
#include
int semode(int handle,int mode);
Description
This function sets the translation mode (whether the file translates or not the \r \n sequences) to the mode specified by its argument. This argument should be either _O_TEXT or _O_BINARY, two manifest constants defined in fcntl.h
Returns
Returns the value of the previous translation mode.
Portability :
Windows
setjmp
Synopsis
1 #include
int setjmp(jmp_buf env);
Description
The setjmp macro saves its calling environment in its jmp_buf argument for later use by the longjmp function.
Returns
If the return is from a direct invocation, the setjmp macro returns the value zero. If the return is from a call to the longjmp function, the setjmp macro returns a nonzero
value.
Environmental limits
An invocation of the setjmp macro shall appear only in one of the following contexts:
? the entire controlling expression of a selection or iteration statement;
? one operand of a relational or equality operator with the other operand an integer constant expression, with the resulting expression being the entire controlling expression of a selection or iteration statement;
? the operand of a unary ! operator with the resulting expression being the entire controlling expression of a selection or iteration statement; or
? the entire expression of an expression statement (possibly cast to void).
If the invocation appears in any other context, the behavior is undefined.
setlocale
Synopsis
#include
char *setlocale(int category, const char *locale);
Description
The setlocale function selects the appropriate portion of the program’s locale as specified by the category and locale arguments. The setlocale function may be used to change or query the program’s entire current locale or portions thereof. The value LC_ALL for category names the program’s entire locale; the other values for category name only a portion of the program’s locale. LC_COLLATE affects the behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of the character handling functions 174) and the multibyte and wide-character functions. LC_MONETARY affects the monetary formatting information returned by the localeconv function. LC_NUMERIC affects the decimal-point character for the formatted input/output functions and the string conversion functions, as well as the nonmonetary formatting information returned by the localeconv function. LC_TIME affects the behavior of the strftime and strfxtime functions.
A value of "C" for locale specifies the minimal environment for C translation; a value of "" for locale specifies the locale-specific native environment. Other implementation-defined strings may be passed as the second argument to setlocale.
At program startup, the equivalent of
setlocale(LC_ALL, "C");
is executed.
The implementation shall behave as if no library function calls the setlocale function.
Returns
If a pointer to a string is given for locale and the selection can be honored, the setlocale function returns a pointer to the string associated with the specified category for the new locale. If the selection cannot be honored, the setlocale function returns a null pointer and the program’s locale is not changed.
Remarks for the lcc-win32/windows run time library implementation
揕ocale refers to the locality (country and language) for which you can customize certain aspects of your program. Some locale-dependent categories include the formatting of dates and the display format for monetary values.
The category argument specifies the parts of a program’s locale information that are affected. The macros used for category and the parts of the program they affect are as follows:
LC_ALL All categories, as listed below
LC_COLLATE The strcoll, _stricoll, wcscoll, _wcsicoll, and strxfrm functions
LC_CTYPE The character-handling functions (except isdigit, isxdigit, mbstowcs, and mbtowc, which are unaffected)
LC_MONETARY Monetary-formatting information returned by the localeconv function
LC_NUMERIC Decimal-point character for the formatted output routines (such as printf), for the data-conversion routines, and for the nonmonetary-formatting information eturned by localeconv
LC_TIME The strftime and wcsftime functions
The locale argument is a pointer to a string that specifies the name of the locale. If locale points to an empty string, the locale is the implementation-defined native environment. A value of 揅 specifies the minimal ANSI conforming environment for C translation. The 揅 locale assumes that all char data types are 1 byte and that their value is always less than 256.
The locale argument takes the following form:
locale :: "lang[_country[.code_page]]"
| ".code_page"
| ""
| NULL
The set of available languages, countries, and code pages includes all those supported by the Win32 NLS API.
If locale is a null pointer, setlocale queries, rather than sets, the international environment, and returns a pointer to the string associated with the specified category. The program’s current locale setting is not changed. For example,
setlocale( LC_ALL, NULL );
returns the string associated with category.
The following examples pertain to the LC_ALL category. Either of the strings ".OCP" and ".ACP" can be used in place of a code page number to specify use of the system default OEM code page and system-default ANSI code page, respectively.
setlocale( LC_ALL, "" ); Sets the locale to the default, which is the system-default ANSI code page obtained from the operating system.
setlocale( LC_ALL, ".OCP" ); Explicitly sets the locale to the current OEM code page obtained from the operating system.
setlocale( LC_ALL, ".ACP" ); Sets the locale to the ANSI code page obtained from the operating system.
setlocale( LC_ALL, "[lang_ctry]" ); Sets the locale to the language and country indicated, using the default code page obtained from the host operating system.
setlocale( LC_ALL, "[lang_ctry.cp]" ); Sets the locale to the language, country, and code page indicated in the [lang_ctry.cp] string. You can use various combinations of language, country, and code page. For example:
setlocale( LC_ALL, "French_Canada.1252" );
// Set code page to French Canada ANSI default
setlocale( LC_ALL, "French_Canada.ACP" );
// Set code page to French Canada OEM default
setlocale( LC_ALL, "French_Canada.OCP" );
setlocale( LC_ALL, "[lang]" ); Sets the locale to the country indicated, using the default country for the language specified, and the system-default ANSI code page for that country as obtained from the host operating system. For example, the following two calls to setlocale are functionally equivalent:
setlocale( LC_ALL, "English" );
setlocale( LC_ALL, "English_United States.1252" );
setlocale( LC_ALL, "[.code_page]" ); Sets the code page to the value indicated, using the default country and language (as defined by the host operating system) for the specified code page.
The category must be either LC_ALL or LC_CTYPE to effect a change of code page. For example, if the default country and language of the host operating system are 揢nited States and 揈nglish, the following two calls to setlocale are functionally equivalent:
setlocale( LC_ALL, ".1252" );
setlocale( LC_ALL, "English_United States.1252");
setvbuf
Synopsis
#include
int setvbuf(FILE * restrict stream, char * restrict buf,
int mode, size_t size);
Description
The setvbuf function may be used only after the stream pointed to by stream has been associated with an open file and before any other operation (other than an unsuccessful call to setvbuf) is performed on the stream. The argument mode determines how stream will be buffered, as follows: _IOFBF causes input/output to be fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes input/output to be unbuffered. If buf is not a null pointer, the array it points to may be used instead of a buffer allocated by the setvbuf function and the argument size specifies the size of the array; otherwise, size may determine the size of a buffer allocated by the setvbuf function. The contents of the array at any time are indeterminate.
Returns
The setvbuf function returns zero on success, or nonzero if an invalid value is given
for mode or if the request cannot be honored.
signal
Synopsis
#include
void (*signal(int sig, void (*func)(int)))(int);
Description
The signal function chooses one of three ways in which receipt of the signal number sig is to be subsequently handled. If the value of func is SIG_DFL, default handling for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored. Otherwise, func shall point to a function to be called when that signal occurs. An invocation of such a function because of a signal, or (recursively) of any further functions called by that invocation (other than functions in the standard library), is called a signal handler.
When a signal occurs and func points to a function, it is implementation-defined whether the equivalent of signal(sig, SIG_DFL); is executed or the implementation prevents some implementation-defined set of signals (at least including sig) from occurring until the current signal handling has completed; in the case of SIGILL, the implementation may alternatively define that no action is taken. Then the equivalent of (*func)(sig); is executed. If and when the function returns, if the value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined value corresponding to a computational exception, the behavior is undefined; otherwise the program will resume execution at the point it was interrupted.
If the signal occurs as the result of calling the abort or raise function, the signal
handler shall not call the raise function.
If the signal occurs other than as the result of calling the abort or raise function, the behavior is undefined if the signal handler refers to any object with static storage duration other than by assigning a value to an object declared as volatile sig_atomic_t,or the signal handler calls any function in the standard library other than the abort function or the signal function with the first argument equal to the signal number corresponding to the signal that caused the invocation of the handler. Furthermore, if such a call to the signal function results in a SIG_ERR return, the value of errno is indeterminate.
At program startup, the equivalent of
signal(sig, SIG_IGN);
may be executed for some signals selected in an implementation-defined manner; the equivalent of signal(sig, SIG_DFL); is executed for all other signals defined by the implementation.
The implementation shall behave as if no library function calls the signal function.
Returns
If the request can be honored, the signal function returns the value of func for the most recent successful call to signal for the specified signal sig. Otherwise, a value of SIG_ERR is returned and a positive value is stored in errno.
Remarks concerning the implementation within the lcc-win32/windows system.
The implementation of signal() is made exttraordinaliry difficult because the lack of documentation about the behaviour of the CRTDLL.DLL run-time library. For the time being, lcc-win32 implements only the catching of SIGSEGV and SIGFPE. The implementation of other signals will be done shortly.
sin
Synopsis
#include
double sin(double x);
Description
The sin functions compute the sine of x (measured in radians).
Returns
The sin functions return the sine value.
If you use the optimization option within lcc-win32 this function will be always inlined.
sinh
Synopsis
#include
double sinh(double x);
float sinhf(float x);
long double sinhl(long double x);
Description
The sinh functions compute the hyperbolic sine of x. A range error occurs if the magnitude of x is too large.
Returns
The sinh functions return the hyperbolic sine value.
sprintf
Synopsis
#include
int sprintf(char * restrict s,const char * restrict format, ...);
Description
The sprintf function is equivalent to fprintf,except that the output is written into
an array (specified by the argument s) rather than to a stream. A null character is written
at the end of the characters written; it is not counted as part of the returned value. If copying takes place between objects that overlap, the behavior is undefined.
Returns
The sprintf function returns the number of characters written in the array, not counting the terminating null character, or a neg ative value if an encoding error occurred.
sqrt
Synopsis
#include
double sqrt(double x);
Description
The sqrt functions compute the nonnegative square root of x. A domain error occurs if
the argument is less than zero.
Returns
The sqrt functions return the value of the square root.
Example :
#include
#include
#include
void main( void )
{
double input = 78.23, answer;
answer = sqrt( input );
if( input < 0 )
printf( "Error: sqrt returns %.2f\n, answer" );
else
printf( "The square root of %.2f is %.2f\n", input, answer );
}
The square root of 78.23 is 8.84
srand
Synopsis
#include
void srand(unsigned int seed);
Description
The srand function uses the argument as a seed for a new sequence of pseudo-random
numbers to be returned by subsequent calls to rand.Ifsrand is then called with the
same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
called before any calls to srand have been made, the same sequence shall be generated
as when srand is first called with a seed value of 1.
The implementation shall behave as if no library function calls the srand function.
Returns
The srand function returns no value.
sscanf
Synopsis
#include
int sscanf(const char * restrict s,const char * restrict format, ...);
Description
The sscanf function is equivalent to fscanf,except that input is obtained from a string (specified by the argument s) rather than from a stream. Reaching the end of the string is equivalent to encountering end-of-file for the fscanf function. If copying takes place between objects that overlap, the behavior is undefined.
Returns
The sscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the sscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure.
strchr
Synopsis
#include
char *strchr(const char *s, int c);
Description
The strchr function locates the first occurrence of c (converted to a char)in the string pointed to by s. The terminating null character is considered to be part of the string.
Returns
The strchr function returns a pointer to the located character, or a null pointer if the
character does not occur in the string.
strcmp
Synopsis
#include
int strcmp(const char *s1, const char *s2);
Description
The strcmp function compares the string pointed to by s1 to the string pointed to by s2.
Returns
The strcmp function returns an integer greater than, equal to, or less than zero, accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
pointed to by s2.
strcmpi , stricmp , _strcmpi , _stricmp
Synopsis
#include
int strcmpi(const char *s1, const char *s2);
int stricmp(const char *s1, const char *s2);
Description
The strcmpi function compares the string pointed to by s1 to the string pointed to by s2 ignoring case differences between each letter.
Returns
The strcmpi function returns an integer greater than, equal to, or less than zero, accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
pointed to by s2.
Remarks :
Lcc-win32 defines both with and without underscores for your convenience. Microsofts supports the names with underscores.
Actually, in CRTDLL.DLL only _strcmpi is exported.
Portability :
Windows
strcoll
Synopsis
#include
int strcoll(const char *s1, const char *s2);
Description
The strcoll function compares the string pointed to by s1 to the string pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
Returns
The strcoll function returns an integer greater than, equal to, or less than zero, accordingly as the string pointed to by s1 is greater than, equal to, or less than the string pointed to by s2 when both are interpreted as appropriate to the current locale.
strcpy
Synopsis
#include
char *strcpy(char * restrict s1,const char * restrict s2);
Description
The strcpy function copies the string pointed to by s2 (including the terminating null character) into the array pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.
Returns
The strcpy function returns the value of s1.
strcspn
Synopsis
#include
size_t strcspn(const char *s1, const char *s2);
Description
The strcspn function computes the length of the maximum initial segment of the string pointed to by s1 which consists entirely of characters not from the string pointed to by
s2.
Returns
The strcspn function returns the length of the segment.
_strdate
Synopsis :
#include
char *_strdate(char *datestr) ;
Description :
The _strdate function copies a date to the buffer pointed to by datestr, formatted mm/dd/yy, where mm is two digits representing the month, dd is two digits representing the day, and yy is the last two digits of the year. For example, the string 12/05/99 represents December 5, 1999. The buffer must be at least 9 bytes long.
Example :
#include
#include
void main(void)
{
char buf[25];
printf("The date is %s\n",strdate(buf));
}
The date is 12/28/98
Remarks :
The locale settings aren’t used by this function.
Lcc-win32 defines both strdate AND _strdate.
strftime
Synopsis
#include
size_t strftime(char * restrict s,size_t maxsize,const char * restrict format,const struct tm * restrict timeptr);
Description
The strftime function places characters into the array pointed to by s as controlled by the string pointed to by format. The format shall be a multibyte character sequence, beginning and ending in its initial shift state. The format string consists of zero or more conversion specifiers and ordinary multibyte characters. A conversion specifier consists of a % character, possibly followed by an E or O modifier character (described below), followed by a character that determines the behavior of the conversion specifier. All ordinary multibyte characters (including the terminating null character) are copied unchanged into the array. If copying takes place between objects that overlap, the behavior is undefined. No more than maxsize characters are placed into the array.
Each conversion specifier is replaced by appropriate characters as described in the following list. The appropriate characters are determined using the LC_TIME category of the current locale and by the values of zero or more members of the broken-down time structure pointed to by timeptr, as specified in brackets in the description. If any of the specified values is outside the normal range, the characters stored are unspecified.
%a is replaced by the locale’s abbreviated weekday name. [tm_wday]
%A is replaced by the locale’s full weekday name. [tm_wday]
%b is replaced by the locale’s abbreviated month name. [tm_mon]
%B is replaced by the locale’s full month name. [tm_mon]
%c is replaced by the locale’s appropriate date and time representation.
%C is replaced by the year divided by 100 and truncated to an integer, as a decimal number (00 99). [tm_year]
%d is replaced by the day of the month as a decimal number (01 31). [tm_mday]
%D is equivalent to ‘‘%m/%d/%y’’ . [ tm_mon, tm_mday, tm_year]
%e is replaced by the day of the month as a decimal number (1 31); a single digit is preceded by a space. [tm_mday]
%F is equivalent to ‘‘%Y %m %d’’ (the ISO 8601 date format). [tm_year, tm_mon, tm_mday]
%g is replaced by the last 2 digits of the week-based year (see below) as a decimal number (00 99). [tm_year, tm_wday, tm_yday]
%G is replaced by the week-based year (see below) as a decimal number (e.g., 1997). [tm_year, tm_wday, tm_yday]
%h is equivalent to ‘‘%b’’ . [ tm_mon]
%H is replaced by the hour (24-hour clock) as a decimal number (00 23). [tm_hour]
%I is replaced by the hour (12-hour clock) as a decimal number (01 12). [tm_hour]
%j is replaced by the day of the year as a decimal number (001 366). [tm_yday]
%m is replaced by the month as a decimal number (01 12). [tm_mon]
%M is replaced by the minute as a decimal number (00 59). [tm_min]
%n is replaced by a new-line character.
%p is replaced by the locale’s equivalent of the AM/PM designations associated with a 12-hour clock. [tm_hour]
%r is replaced by the locale’s 12-hour clock time. [tm_hour, tm_min, tm_sec]
%R is equivalent to ‘‘%H:%M’’ . [ tm_hour, tm_min]
%S is replaced by the second as a decimal number (00 60). [tm_sec]
%t is replaced by a horizontal-tab character.
%T is equivalent to ‘‘%H:%M:%S’’ (the ISO 8601 time format). [tm_hour, tm_min, tm_sec]
%u is replaced by the ISO 8601 weekday as a decimal number (1 7), where Monday is 1. [tm_wday]
%U is replaced by the week number of the year (the first Sunday as the first day of week 1) as a decimal number (00 53). [tm_year, tm_wday, tm_yday]
%V is replaced by the ISO 8601 week number (see below) as a decimal number (01 53). [tm_year, tm_wday, tm_yday]
%w is replaced by the weekday as a decimal number (0 6), where Sunday is 0. [tm_wday]
%W is replaced by the week number of the year (the first Monday as the first day of week 1) as a decimal number (00 53). [tm_year, tm_wday, tm_yday]
%x is replaced by the locale’s appropriate date representation.
%X is replaced by the locale’s appropriate time representation.
%y is replaced by the last 2 digits of the year as a decimal number (00 99). [tm_year]
%Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]
%z is replaced by the offset from UTC in the ISO 8601 format ‘‘ 0430’’ (meaning 4 hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time zone is determinable. [tm_isdst]
%Z is replaced by the locale’s time zone name or abbreviation, or by no characters if no time zone is determinable. [tm_isdst]
%% is replaced by %.
Some conversion specifiers can be modified by the inclusion of the E or O modifier characters to indicate an alternative format or specification. If the alternative format or specification does not exist for the current locale, the modifier is ignored.
%Ec is replaced by the locale’s alternative date and time representation.
%EC is replaced by the name of the base year (period) in the locale’s alternative representation.
%Ex is replaced by the locale’s alternative date representation.
%EX is replaced by the locale’s alternative time representation.
%Ey is replaced by the offset from %EC (year only) in the locale’s alternative representation.
%EY is replaced by the locale’s full alternative year representation.
%Od is replaced by the day of the month, using the locale’s alternative numeric symbols (filled as needed with leading zeros, or with leading spaces if there is no alternative symbol for zero).
%Oe is replaced by the day of the month, using the locale’s alternative numeric symbols (filled as needed with leading spaces).
%OH is replaced by the hour (24-hour clock), using the locale’s alternative numeric symbols.
%OI is replaced by the hour (12-hour clock), using the locale’s alternative numeric symbols.
%Om is replaced by the month, using the locale’s alternative numeric symbols.
%OM is replaced by the minutes, using the locale’s alternative numeric symbols.
%OS is replaced by the seconds, using the locale’s alternative numeric symbols.
%Ou is replaced by the ISO 8601 weekday as a number in the locale’s alternative representation, where Monday is 1.
%OU is replaced by the week number, using the locale’s alternative numeric symbols.
%OV is replaced by the ISO 8601 week number, using the locale’s alternative numeric symbols.
%Ow is replaced by the weekday as a number, using the locale’s alternative numeric symbols.
%Ou is replaced by the week number of the year, using the locale’s alternative numeric symbols.
%Oy is replaced by the last 2 digits of the year, using the locale’s alternative numeric symbols.
%g, %G, and %V give values according to the ISO 8601 week-based year. In this system, weeks begin on a Monday and week 1 of the year is the week that includes January 4th, which is also the week that includes the first Thursday of the year, and is also the first week that contains at least four days in the year. If the first Monday of January is the 2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus, for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53.If December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and %V is replaced by 1.
Not implemented in CRTDLL.DLL
If a conversion specifier is not one of the above, the behavior is undefined.
In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
following specifiers are:
%a the first three characters of %A.
%A one of ‘‘Sunday’’ , ‘‘ Monday’’, ... , ‘‘Saturday’’ .
%b the first three characters of %B.
%B one of ‘‘January’’ , ‘‘ February’’, ... , ‘‘December’’ .
%c equivalent to ‘‘%A %B %d %T %Y’’ .
%p one of ‘‘am’’ or ‘‘ pm’’ .
%r equivalent to ‘‘%I:%M:%S %p’’ .
%x equivalent to ‘‘%A %B %d %Y’’ .
%X equivalent to %T.
%Z implementation-defined.
Returns
If the total number of resulting characters including the terminating null character is not more than maxsize, the strftime function returns the number of characters placed into the array pointed to by s not including the terminating null character. Otherwise, zero is returned and the contents of the array are indeterminate.
strlen
Synopsis
#include
size_t strlen(const char *s);
Description
The strlen function computes the length of the string pointed to by s.
Returns
The strlen function returns the number of characters that precede the terminating null character.
Note : If the optimization option is choosen, lcc-win32 will inline this function.
strlwr
Synopsis
#include
size_t strlwr(const char *s);
Description
The strlwr function coverts its input string in lowercase
Returns
The strlwr function returns a pointer to the converted string.
Portability :
Windows function
strncat
Synopsis
#include
char *strncat(char * restrict s1,const char * restrict s2,
size_t n);
Description
The strncat function appends not more than n characters (a null character and characters that follow it are not appended) from the array pointed to by s2 to the end of the string pointed to by s1. The initial character of s2 overwrites the null character at the end of s1. A terminating null character is always appended to the result. If copying takes place between objects that overlap, the behavior is undefined.
Returns
The strncat function returns the value of s1.
strncmp , strnicmp
Synopsis
#include
int strncmp(const char *s1, const char *s2, size_t n);
Description
The strncmp function compares not more than n characters (characters that follow a null character are not compared) from the array pointed to by s1 to the array pointed to by s2.
Returns
The strncmp function returns an integer greater than, equal to, or less than zero, accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal to, or less than the possibly null-terminated array pointed to by s2.
Strnicmp ignores the case when comparing the strings.
Portability :
strnicmp is a strictly windows function.
strncpy
Synopsis
#include
char *strncpy(char * restrict s1,
const char * restrict s2,
size_t n);
Description
The strncpy function copies not more than n characters (characters that follow a null character are not copied) from the array pointed to by s2 to the array pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.
If the array pointed to by s2 is a string that is shorter than n characters, null characters are appended to the copy in the array pointed to by s1, until n characters in all have been written.
Returns
The strncpy function returns the value of s1.
strpbrk
Synopsis
#include
char *strpbrk(const char *s1, const char *s2);
Description
The strpbrk function locates the first occurrence in the string pointed to by s1 of any character from the string pointed to by s2.
Returns
The strpbrk function returns a pointer to the character, or a null pointer if no character from s2 occurs in s1.
strrchr
Synopsis
#include
char *strrchr(const char *s, int c);
Description
The strrchr function locates the last occurrence of c (converted to a char) in the
string pointed to by s. The terminating null character is considered to be part of the string.
Returns
The strrchr function returns a pointer to the character, or a null pointer if c does not occur in the string.
strspn
Synopsis
#include
size_t strspn(const char *s1, const char *s2);
Description
The strspn function computes the length of the maximum initial segment of the string pointed to by s1 which consists entirely of characters from the string pointed to by s2.
Returns
The strspn function returns the length of the segment.
strstr
Synopsis
#include
char *strstr(const char *s1, const char *s2);
Description
The strstr function locates the first occurrence in the string pointed to by s1 of the sequence of characters (excluding the terminating null character) in the string pointed to by s2.
Returns
The strstr function returns a pointer to the located string, or a null pointer if the string is not found. If s2 points to a string with zero length, the function returns s1.
strtod
Synopsis
#include
double strtod(const char * restrict nptr, char ** restrict endptr);
Description
The strtod function converts the initial portion of the string pointed to by nptr to double, float, and long double representation, respectively. First, they decompose the input string into three parts: an initial, possibly empty, sequence of white-space characters (as specified by the isspace function), a subject sequence resembling a floating-point constant or representing an infinity or NaN; and a final string of one or more unrecognized characters, including the terminating null character of the input string. Then, they attempt to convert the subject sequence to a floating-point number, and return the result.
The expected form of the subject sequence is an optional plus or minus sign, then one of the following:
? a nonempty sequence of decimal digits optionally containing a decimal-point character, then an optional exponent part as defined in 6.4.4.2;
? a0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a decimal-point character, then an optional binary-exponent part as defined in 6.4.4.2, where either the decimal-point character or the binary-exponent part is present;
? one of INF or INFINITY, ignoring case
? one of NAN or NAN(n-char-sequence opt ), ignoring case in the NAN part, where:
n-char-sequence:
digit
nondigit
n-char-sequence digit
n-char-sequence nondigit
The subject sequence is defined as the longest initial subsequence of the input string, starting with the first non-white-space character, that is of the expected form. The subject sequence contains no characters if the input string is not of the expected form. If the subject sequence has the expected form for a floating-point number, the sequence of characters starting with the first digit or the decimal-point character (whichever occurs first) is interpreted as a floating constant according to the rules of 6.4.4.2, except that the decimal-point character is used in place of a period, and that if neither an exponent part, a binary-exponent part, nor a decimal-point character appears, a decimal point is assumed to follow the last digit in the string. A character sequence INF or INFINITY is interpreted as an infinity, if representable in the return type, else like a floating constant that is too large for the range of the return type. A character sequence NAN or NAN(n-char-sequence opt ), is interpreted as a quiet NaN, if supported in the return type, else like a subject sequence part that does not have the expected form; the meaning of the n-char sequences is implementation-defined.233) If the subject sequence begins with a minus sign, the value resulting from the conversion is negated.234) A pointer to the final string is stored in the object pointed to by endptr, provided that endptr is not a null pointer.
If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, then the value resulting from the conversion is correctly rounded.
In other than the "C" locale, additional locale-specific subject sequence forms may be accepted.
If the subject sequence is empty or does not have the expected form, no conversion is performed; the value of nptr is stored in the object pointed to by endptr, provided that endptr is not a null pointer.
Recommended practice
If the subject sequence has the hexadecimal form and FLT_RADIX is not a power of 2, then the result should be one of the two numbers in the appropriate internal format that are adjacent to the hexadecimal floating source value, with the extra stipulation that the error should have a correct sign for the current rounding direction.
If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in ) significant digits, then the value resulting from the conversion should be correctly rounded. If the subject sequence D has the decimal form and more than DECIMAL_DIG significant digits, consider the two bounding, adjacent decimal strings L and U, both having DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L ??D ??U. The result of conversion should be one of the (equal or adjacent) values that would be obtained by correctly rounding L and U according to the current rounding direction, with the extra stipulation that the error with respect to D should have a correct sign for the current rounding direction.
Returns
The functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, plus or minus HUGE_VAL, HUGE_VALF,orHUGE_VALL is returned (according to the return type and sign of the value), and the value of the macro ERANGE is stored in errno.If the result underflows (7.12.1), the functions return a value whose magnitude is no greater than the smallest normalized positive number in the return type; whether errno acquires the value ERANGE is implementation-defined.
strtok
Synopsis
#include
char *strtok(char * restrict s1,const char * restrict s2);
Description
A sequence of calls to the strtok function breaks the string pointed to by s1 into a sequence of tokens, each of which is delimited by a character from the string pointed to by s2. The first call in the sequence has a non-null first argument; subsequent calls in the sequence have a null first argument. The separator string pointed to by s2 may be different from call to call.
The first call in the sequence searches the string pointed to by s1 for the first character that is not contained in the current separator string pointed to by s2. If no such character is found, then there are no tokens in the string pointed to by s1 and the strtok function returns a null pointer. If such a character is found, it is the start of the first token.
strtol, strtoul
Synopsis
#include
long int strtol(const char * restrict nptr,char ** restrict endptr,int base);
unsigned long int strtoul(const char * restrict nptr,
char ** restrict endptr,int base);
Description
The strtol, and strtoul functions convert the initial portion of the string pointed to by nptr to long int, long long int, unsigned long int, and unsigned long long int representation, respectively. First, they decompose the input string into three parts: an initial, possibly empty, sequence of white-space characters (as specified by the isspace function), a subject sequence resembling an integer represented in some radix determined by the value of base, and a final string of one or more unrecognized characters, including the terminating null character of the input string. Then, they attempt to convert the subject sequence to an integer, and return the result.
If the value of base is zero, the expected form of the subject sequence is that of an integer constant optionally preceded by a plus or minus sign, but not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the expected form of the subject sequence is a sequence of letters and digits representing an integer with the radix specified by base, optionally preceded by a plus or minus sign, but not including an integer suffix. The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only letters and digits whose ascribed values are less than that of base are permitted. If the value of base is 16, the characters 0x or 0X may optionally precede the sequence of letters and digits, following the sign if present.
The subject sequence is defined as the longest initial subsequence of the input string, starting with the first non-white-space character, that is of the expected form. The subject sequence contains no characters if the input string is empty or consists entirely of white space, or if the first non-white-space character is other than a sign or a permissible letter or digit.
If the subject sequence has the expected form and the value of base is zero, the sequence of characters starting with the first digit is interpreted as an integer constant according to the rules of 6.4.4.1. If the subject sequence has the expected form and the value of base is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value as given above. If the subject sequence begins with a minus sign, the value resulting from the conversion is negated (in the return type). A pointer to the final string is stored in the object pointed to by endptr, provided that endptr is not a null pointer.
In other than the "C" locale, additional locale-specific subject sequence forms may be accepted.
If the subject sequence is empty or does not have the expected form, no conversion is performed; the value of nptr is stored in the object pointed to by endptr, provided that endptr is not a null pointer.
Returns
The strtol, and strtoul functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN, LLONG_MAX, ULONG_MAX,orULLONG_MAX is returned (according to the return type and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
strxfrm
Synopsis
#include
size_t strxfrm(char * restrict s1,const char * restrict s2, size_t n);
Description
The strxfrm function transforms the string pointed to by s2 and places the resulting string into the array pointed to by s1. The transformation is such that if the strcmp function is applied to two transformed strings, it returns a value greater than, equal to, or less than zero, corresponding to the result of the strcoll function applied to the same two original strings. No more than n characters are placed into the resulting array pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to be a null pointer. If copying takes place between objects that overlap, the behavior undefined.
Returns
The strxfrm function returns the length of the transformed string (not including the terminating null character). If the value returned is n or more, the contents of the array pointed to by s1 are indeterminate.
_sopen , _wsopen
Synopsis :
int _sopen(const char *filename, int oflag, int shflag [, int pmode ] );
int _wsopen(const wchar_t *filename,int oflag,int shflag [,int pmode ] );
Description :
This functions open a file in shareable mode determined by the shflag argument.
They return a file handle for the opened file. A return value of –1 indicates an error, in which case errno is set to one of the following values:
EACCES Given path is a directory, or file is read-only, but an open-for-writing operation as attempted.
EEXIST _O_CREAT and _O_EXCL flags were specified, but filename already exists.
EINVAL Invalid oflag or shflag argument.
EMFILE No more file handles available.
ENOENT File or path not found.
The argument shflag is a constant expression consisting of one of the following manifest constants, defined in SHARE.H.
_SH_DENYRW Denies read and write access to file
_SH_DENYWR Denies write access to file
_SH_DENYRD Denies read access to file
_SH_DENYNO Permits read and write access
Portability :
Windows
For convenience, lcc-win32 defines this values without underscores too.
spawn , wspawnl
Synopsis :
int _spawnl( int mode, const char *cmdname, const char *arg0, const char *arg1, ... const char *argn, NULL );
int _wspawnl( int mode, const wchar_t *cmdname, const wchar_t *arg0,const wchar_t *arg1, ... const wchar_t *argn, NULL );
This functions do not belong to the standard ANSI C library.
Description :
This functions create and execute a new process. Its parameters are :
? mode Execution mode for the process to be created. This can be either one of the constants _P_WAIT or _P_NOWAIT, indicating whether the process starts synchronously or asynchronously.
? cmdname The path of the program to execute.
? arg0...argN The arguments to be passed to the program.
_splitpath
Synopsis :
void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext );
This function does NOT belong to the ANSI C library.
Description :
The _splitpath function breaks a path into its four components. _splitpath automatically handles multibyte-character string arguments as appropriate, recognizing multibyte-character sequences according to the multibyte code page currently in use.
Each argument is stored in a buffer; the manifest constants _MAX_DRIVE, _MAX_DIR, _MAX_FNAME, and _MAX_EXT (defined in STDLIB.H) specify the maximum size necessary for each buffer. The other arguments point to buffers used to store the path elements. After a call to _splitpath is executed, these arguments contain empty strings for components not found in path. You can pass a NULL pointer to _splitpath for any component you don’t need.
Returns :
This function returns no value.
_stat
Synopsis :
#include
#include