Watcom C Library Reference : filelength, fileno, _floodfill, _floodfill_w, floor, flushall

 

 

 

 

filelength

 

Synopsis : #include <io.h> 

              long int filelength( int handle );

 


Description : The filelength function returns the number of bytes in the opened file indicated by the file handle handle.

 

 

Returns : If an error occurs, (-1L) is returned. When an error has occurred, errno contains a value indicating the type of error that has been detected. Otherwise, the number of bytes written to the file is returned.

 

 

See Also : fstat, lseek, tell

 


Example :

#include <sys/types.h> 

#include <fcntl.h> 

#include <stdio.h> 

#include <io.h>


void main( )

{
    int     handle;


    /* open a file for input  */

    handle = open( "file", O_RDONLY | O_TEXT );

    if( handle != -1 ) {

        printf( "Size of file is %ld bytes\n", filelength( handle ) ); 

        close ( handle );.

    }

}

 


produces the following :
Size of file is 461 bytes

 

Classification : WATCOM
Systems : All

 

 

 

 

 

fileno

 

Synopsis : #include <stdio.h> 

              int fileno ( FILE *stream );



Description : The fileno function returns the number of the file handle for the file designated by stream. This number can be used in POSIX input/output calls anywhere the value returned by open can be used. The following symbolic values in <io.h> define the file handles that are associated with the C language stdin, stdout, stderr, stdaux, and stdprn files when the application is started.

 Value  Meaning
 STDIN_FILENO  Standard input file number, stdin (0)
 STDOUT_FILENO  Standard output file number, stdout (1)
 STDERR_FILENO  Standard error file number, stderr (2)
 STDAUX_FILENO  Standard auxiliary file number, stdaux (3)
 STDPRN_FILENO  Standard printer file number, stdprn (4)

 

 

Returns : The fileno function returns the number of the file handle for the file designated by stream. If an error occurs, a value of -1 is returned and errno is set to indicate the error.

 

 

See Also : open

 


Example :

#include <stdio.h>


void main( )

{
    FILE     *stream;


    stream = fopen( "file", "r" );

    printf( "File number is %d\n", fileno ( stream ) );

    fclose( stream );

}

 


produces the following :
File number is 7

 

Classification : POSIX 1003.1
Systems : All

 

 

 

 

 

_floodfill, _floodfill_w

 

Synopsis : #include <graph.h> 

              short _FAR _floodfill( short x, short y, short stop_color ) ;
              short _FAR floodfill_w( double x, double y, short stop_color ) ;


Description : The _floodfill functions fill an area of the screen. The _floodfill function uses the view coordinate system. The _floodfill_w function uses the window coordinate system.


The filling starts at the point (x, y) and continues in all directions: when a pixel is filled, the neighbouring pixels (horizontally and vertically) are then considered for filling. Filling is done using the current color and fill mask. No filling will occur if the point (x, y) lies outside the clipping region.


If the argument stop_color is a valid pixel value, filling will occur in each direction until a pixel is encountered with a pixel value of stop_color. The filled area will be the area around (x, y), bordered by stop_color. No filling will occur if the point (x, y) has the pixel value stop_color.


If stop_color has the value (-1), filling occurs until a pixel is encountered with a pixel value different from the pixel value of the starting point (x ,y). No filling will occur if the pixel value of the point (x, y) is the current color.

 

 

Returns : The _floodfill functions return zero when no filling takes place; a non-zero value is returned to indicate that filling has occurred.

 

 

See Also : _setcliprgn, _setcolor, _setfillmask, -setplotaction

 


Example :

#include <conio.h> 

#include <graph.h>


void main( )

{
    _setvideomode ( _VRES16COLOR );

 

    _setcolor ( 1 );

    _ellipse( _GBORDER, 120, 90, 520, 390 );

 

    _setcolor ( 2 );

    _floodfill( 320, 240, 1);

 

    getch( );

    _setvideomode ( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : _floodfill - DOS, QNX 

             _floodfill_w - DOS, QNX

 

 

 

 

 

floor

 

Synopsis : #include <math.h> 

             double floor( double x );

 


Description : The floor function computes the largest integer not greater than x.

 

 

Returns : The floor function computes the largest integer not greater than x, expressed as a double.

 

 

See Also : ceil, fmod

 


Example :

#include <stdio.h> 

#include <math.h>


void main( )

{
    printf( "%f\n", floor( -3.14 ) );

    printf( "%f\n", floor( -3. ) );

    printf( "%f\n", floor( 0. ) );

    printf( "%f\n", floor( 3.14 ) );

    printf( "%f\n", floor( 3. ) );

}

 


produces the following :
-4.000000 

-3.000000 

0.000000 

3.000000 

3.000000

 

Classification : ANSI
Systems : All

 

 

 

 

 

flushall

 

Synopsis : #include <stdio.h> 

              int flushall( void );

 


Description : The flushall function clears all buffers associated with input streams and writes any buffers associated with output streams. A subsequent read operation on an input file causes new data to be read from the associated file or device. The function is equivalent to calling the fflush for all open stream files.

 

 

Returns : The flushall function returns the number of open streams. When an output error occurs while writing to a file, the errno global variable will be set.

 

 

See Also : fopen, fflush

 


Example :

#include <stdio.h>


void main( )

{
    printf( "The number of open files is %d\n", flushall( ) );

}

 


produces the following :
The number of open files is 4

 

Classification : WATCOM
Systems : All

 

 

 

 

 

 

 

 

This manual describes the WATCOM C library for DOS, Windows, and OS/2, It includes the Standard C Library (as defined in the ANSI C Standard).

 

WATCOM C Language Reference manual describes the ANSI C Programming language and extensions to it which are supported by WATCOM C/C++ (32bit)

 

 

 

728x90
반응형
Posted by 전화카드
,