'_outmem func'에 해당되는 글 1건

  1. 2021.08.18 Watcom C Library : opendir, _os_handle, _outgtext, _outmem

 

 

Watcom C Library Reference : opendir, _os_handle, _outgtext, _outmem

 

 

 

 

opendir

 

Synopsis : #include <direct.h> 

              DIR *opendir( const char *dirname );

 


Description : The opendir function is used in conjunction with the functions readdir and closedir to obtain the list of file names contained in the directory specified by dirname. The path indicated by dirname can be either relative to the current working directory or it can be an absolute path name. As an extension to POSIX, the last part of dirname can contain the characters '?' and '*' for matching multiple files within a directory.


The file <direct.h> contains definitions for the structure dirent.

typedef struct dirent { 

          char     d_dta[ 21 ];              /* disk transfer area   */ 

          char     d_attr;                     /* file's attribute       */ 

          unsigned short int d_time;          /* file's time           */

          unsigned short int d_date;          /* file's date           */

          long     d_size;                    /* file's size            */ 

          char     d_name[ 13 ];           /* file's name           */

          ino_t     d_ino;                     /* serial number         */ 

          char     d_first;                    /* flag for 1st time      */ 

} DIR;

More than one directory can be read at the same time using the opendir, readdir, and closedir functions.

 

 

Returns : The opendir function, if successful, returns a pointer to a structure required for subsequent calls to readdir to retrieve the file names matching the pattern specified by dirname. The opendir function returns NULL if dirname is not a valid pathname, or if there are no files matching dirname.

 

 

Errors : When an error has occurred, errno contains a value indicating the type of error that has been detected.

 Constant  Meaning
 EACCES  Search permission is denied for a component of dirname or read permission is denied for dirname.
 ENOENT  The named directory does not exist.

 

 

See Also : closedir, _dos_find Functions, readdir

 


Example :

To get a list of files contained in the directory \watcom\h on your default disk :


#include <stdio.h> 

#include <direct.h>


void main( )

{
    DIR     *dirp;

    struct  dirent *direntp;


    dirp = opendir( "\\watcom\\h" );

    if( dirp == NULL ) {
        perror( "" );

    } else {

        for ( ;; ) {
            direntp = readdir( dirp );

            if( direntp == NULL ) break;

            printf( "%s\n", direntp->d_name );

        }     
       closedir( dirp );

    }

}


Note the use of two adjacent backslash characters (\) within character-string constants to signify a single backslash.

 

Classification : POSIX 1003.1
Systems : All

 

 

 

 

 

_os_handle

 

Synopsis : #include <io.h> 

              int _os_handle( int handle );

 


Description : The _os_handle function takes a POSIX-style file handle specified by handle. It returns the corresponding operating system level handle.

 

 

Returns : The _os_handle function returns the operating system handle that corresponds to the specified POSIX-style file handle.

 

 

See Also : _hdopen, close, fdopen, open

 


Example :

#include <stdio.h> 

#include <io.h>


void main( )

{
    int     handle;

    FILE   *fp;

 

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

    if( fp != NULL) {
        handle = _os_handle( fileno ( fp ) );

        fclose( fp );

    }

}

 

Classification : WATCOM
Systems : DOS, Win, OS/2 1.x(all), OS/2 2.x, NT

 

 

 

 

 

_outgtext

 

Synopsis : #include <graph.h> 

              void _FAR _outgtext( char _FAR *text );

 


Description : The _outgtext function displays the character string indicated by the argument text. The string must be terminated by a null character ('\0').


The string is displayed starting at the current position (see the _moveto function) in the current color and in the currently selected font (see the _setfont function). The current position is updated to follow the displayed text.


When no font has been previously selected with _setfont, a default font will be used. The default font is an 8-by-8 bit-mapped font.


The graphics library can display text in three different ways.

 1. The _outtext and _outmem functions can be used in any video mode. However, this variety of text can be displayed in only one size.
 2. The _grtext function displays text as a sequence of line segments, and can be drawn in different sizes, with different orientations and alignments.
 3. The _outgtext function displays text in the currently selected font. Both bit-mapped and vector fonts are supported; the size and type of text depends on the fonts that are available.

 

 

Returns : The _outgtext function does not return a value.

 

 

See Also : _registerfonts, _unregisterfonts, _setfont, _getfontinfo, _getgtextextent, _setgtextvector, _getgtextvector, _outtext, _outmem, _grtext

 


Example :

#include <conio.h> 

#include <stdio.h> 

#include <graph.h>


main( )

{
    int     i, n;

    char   buf[10];


    _setvideomode( _VRES16COLOR );

    n = _registerfonts( "*.fon" );

    for( i = 0; i < n; ++i ) {
        sprintf( buf, "n%d", i );

        _setfont( buf );

        _moveto( 100, 100 );

        _outgtext ( "WATCOM Graphics" );

        getch( );

        _clearscreen( _GCLEARSCREEN );

    }


    _unregisterfonts( );

    _setvideomode( _DEFAULTMODE );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

_outmem

 

Synopsis : #include <graph.h> 

              void _FAR _outmem( char _FAR *text, short length );

 


Description : The _outmem function displays the character string indicated by the argument text. The argument length specifies the number of characters to be displayed. Unlike the _outtext function, _outmem will display the graphical representation of characters such as ASCII 10 and 0, instead of interpreting them as control characters.


The text is displayed using the current text color (see the _settextcolor function), starting at the current text position (see the _settextposition function). The text position is updated to follow the end of the displayed text.


The graphics library can display text in three different ways.

 1. The _outtext and _outmem functions can be used in any video mode. However, this variety of text can be displayed in only one size.
 2. The _grtext function displays text as a sequence of line segments, and can be drawn in different sizes, with different orientations and alignments.
 3. The _outgtext function displays text in the currently selected font. Both bit-mapped and vector fonts are supported; the size and type of text depends on the fonts that are available.

 


Returns : The _outmem function does not return a value.

 

 

See Also : _settextcolor, _settextposition, _settextwindow, _grtext, _outtext, _outgtext

 


Example :

#include <conio.h> 

#include <graph.h>


main( )

{
    int     i;

    char   buf[1];


    _clearscreen( _GCLEARSCREEN );

    for( i = 0; i <= 255; ++i ) {

        _settextposition ( 1 + i % 16, 1 + 5 * ( i / 16 ) ) ;

        buf[0] = i;

        _outmem( buf, 1 );

    }
    getch( );

}

 

Classification : PC Graphics
Systems : DOS, QNX

 

 

 

 

 

 

 

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 전화카드
,