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

  1. 2021.07.07 Watcom C Library : _lineto, _lineto_w, localecony, localtime Functions, lock

 

 

Watcom C Library Reference : _lineto, _lineto_w, localecony, localtime Functions, lock

 

 

 

 

_lineto, _lineto_w

 

Synopsis : #include <graph.h> 

              short _FAR _lineto( short x, short y );
              short _FAR _lineto_w( double x, double y );

 


Description : The _lineto functions draw straight lines. The _lineto function uses the view coordinate system. The _lineto_w function uses the window coordinate system.


The line is drawn from the current position to the point at the coordinates (x, y). The point (x, y) becomes the new current position. The line is drawn with the current plotting action using the current line style and the current color.

 

 

Returns : The _lineto functions return a non-zero value when the line was successfully drawn; otherwise, zero is returned.

 

 

See Also : _moveto, _setcolor, _setlinestyle, _setplotaction

 


Example :

#include <conio.h> 

#include <graph.h>


void main( )

{
    _setvideomode( _VRES16COLOR );

    _moveto( 100, 100);

    _lineto( 540, 100 );

    _lineto( 320, 380 );

    _lineto( 100, 100 );

 

    getch( );

    _setvideomode( _DEFAULTMODE );

}

 


produces the following :

 

 

Classification : PC Graphics
Systems : _lineto - DOS, QNX 

             _lineto_w - DOS, QNX

 

 

 

 

 

localecony

 

Synopsis : #include <locale.h> 

              struct lconv *localeconv( void );

 


Description : The localecony function sets the components of an object of type struct lconv with values appropriate for the formatting of numeric quantities according to the current locale. The components of the struct lcony and their meanings are as follows:

 Component  Meaning
 char *decimal_point  The decimal-point character used to format non-monetary quantities.
 char *thousands_sep  The character used to separate groups of digits to the left of the decimal-point character in formatted non-monetary quantities.
 char *grouping  A string whose elements indicate the size of each group of digits in formatted non-monetary quantities.
 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 Codes for the Representation of Currency and Funds. The fourth character (immediately preceding the null character) is the character used to separate the international currency symbol from the monetary quantity.
 char *currency_symbol  The local currency symbol applicable to the current locale.
 char *mon_decimal point  The decimal-point character used to format monetary quantities.
 char *mon_thousands sep  The character used to separate groups of digits to the left of the decimal-point character 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 monetary quantity.
 char *negative_sign  The string used to indicate a negative-valued monetary quantity.
 char int_frac_digits  The number of fractional digits (those to the right of the decimal-point) to be displayed in an internationally formatted monetary quantity.
 char frac_digits  The number of fractional digits (those to the right of the decimal-point) to be displayed in a formatted monetary quantity.
 char p_cs_precedes  Set to 1 or 0 if the currency_symbol respectively precedes or follows the value for a nonnegative formatted monetary quantity.
 char p_sep_by_space  Set to 1 or 0 if the currency_symbol respectively is or is not separated by a space from the value for a nonnegative formatted monetary quantity.
 char n_cs_precedes  Set to 1 or 0 if the currency_symbol respectively precedes or follows the value for a negative formatted monetary quantity.
 char n_sep_by_space  Set to 1 or 0 if the currency_symbol respectively is or is not separated by a space from the value for a negative formatted monetary quantity.
 char p_sign_posn  The position of the positive_sign for a nonnegative formatted monetary quantity.
 char n_sign_posn  The position of the positive_sign for a negative formatted monetary quantity.

 

 

The elements of grouping and mon_grouping are interpreted according to the following:

 Value  Meaning
 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 value is the number of digits that comprise the current group. The next element is examined to determine the size of the next group of digits to the left of the current group.

 

 

The value of p_sign_posn and n_sign_posn is interpreted as follows:

 Value  Meaning
 0   Parentheses surround the quantity and currency_symbol.
 1  The sign string precedes the quantity and currency_symbol.
 2  The sign string follows the quantity and currency_symbol.
 3  The sign string immediately precedes the quantity and currency_symbol.
 4  The sign string immediately follows the quantity and currency_symbol.

 

 

 

Returns : The localecony function returns a pointer to the filled-in object.

 

 

See Also : setlocale

 


Example :

#include <stdio.h> 

#include <locale.h>


void main( )

{
    struct lconv *lc;

 

    lc = localecony( );

    printf( "*decimal_point (%s)\n",        lc->decimal_point );
    printf( "*thousands_sep (%s) \n",      lc->thousands_sep );

    printf( "*int_curr_symbol (%s) \n",     lc->int_curr_symbol );
    printf( "*currency_symbol (%s) \n",    lc->currency_symbol );
    printf( "*mon_decimal_point (%s) \n", lc->mon_decimal_point );
    printf( "*mon thousands sep (%s) \n", lc->mon_thousands_sep);

 

    printf( "*mon_grouping (%s) \n",   lc->mon_grouping );
    printf( "*grouping (%s)\n",          lc->grouping );
    printf( "*positive_sign (%s) \n",     lc->positive_sign );
    printf( "*negative_sign (%s)\n",     lc->negative_sign );
    printf( "int_frac_digits (%d) \n",      lc->int_frac_digits);
    printf( "frac_digits (%d) \n",         lc->frac_digits );
    printf( "p_cs_precedes (%d) \n",    lc->p_cs_precedes );
    printf( "p_sep_by_space (%d) \n",  lc->p_sep_by_space );
    printf( "n_cs_precedes (%d) \n",    lc->n_cs_precedes );
    printf( "n_sep_by_space (%d)\n",   lc->n_sep_by_space );
    printf( "p_sign_posn (%d)\n",       lc->p_sign_posn );
    printf( "n_sign_posn (%d)\n",       lc->n_sign_posn );

}

 

Classification : ANSI
Systems : All

 

 

 

 

 

localtime Functions

 

Synopsis : #include <time.h>

              struct tm * localtime( const time_t *timer );

              struct tm *_localtime( const time_t *timer, struct tm *tmbuf );

 

              struct tm {
                  int tm_sec;     /* seconds after the minute   -- [0,61] */

                  int tm_min;     /* minutes after the hour      -- [0,59] */

                  int tm_hour;     /* hours after midnight       -- [0,23] */ 

                  int tm_mday;    /* day of the month          -- [1,31] */ 

                  int tm_mon;     /* months since January     -- [0,11] */

                  int tm_year;     /* years since 1900                      */

                  int tm_wday;    /* days since Sunday        -- [0,6]  */

                  int tm_yday;    /* days since January 1      -- [0,365] */

                  int tm_isdst;    /* Daylight Savings Time flag */
              };

 


Description : The localtime functions convert the calendar time pointed to by timer into a structure of type tm, of time information, expressed as local time. Whenever localtime is called, the tzset function is also called.


The calendar time is usually obtained by using the time function. That time is Coordinated Universal Time (UTC) (formerly known as Greenwich Mean Time (GMT)).


The function _localtime places the converted time in the tm structure pointed to by tmbuf, and the function localtime places the converted time in a static structure that is re-used each time localtime is called.


The time set on the computer with the DOS time command and the DOS date command reflects the local time. The environment variable TZ is used to establish the time zone to which this local time applies. See the section The TZ Environment Variable for a discussion of how to set the time zone.

 

 

Returns : The localtime functions return a pointer to a tm structure containing the time information.

 

 

See Also : asctime, clock, ctime, difftime, gmtime, mktime, strftime, time, tzset

 


Example :

#include <stdio.h> 

#include <time.h>


void main( )

{
    time_t time_of_day;

    auto char buf[26];

    auto struct tm tmbuf;


    time_of_day = time( NULL );

    _localtime( &time_of_day, &tmbuf );

    printf( "It is now: %s", _asctime( &tmbuf, buf ) ) ;

}

 


produces the following :
It is now: Sat Mar 21 15:58:27 1999

 

Classification : localtime is ANSI, _localtime is not ANSI
Systems : localtime - All 

             _localtime - All

 

 

 

 

 

lock

 

Synopsis : #include <io.h> 

              int lock( int handle, unsigned long offset, unsigned long nbytes );

 


Description : The lock function locks nbytes amount of data in the file designated by handle starting at byte offset in the file. This prevents other processes from reading or writing into the locked region until an unlock has been done for this locked region of the file.


Multiple regions of a file can be locked, but no overlapping regions are allowed. You cannot unlock multiple regions in the same call, even if the regions are contiguous. All locked regions of a file should be unlocked before closing a file or exiting the program.


With DOS, locking is supported by version 3.0 or later. Note that SHARE.COM or SHARE.EXE must be installed.

 

 

Returns : The lock function returns zero if successful, and -1 when an error occurs. When an error has occurred, errno contains a value indicating the type of error that has been detected.

 

 

See Also : locking, open, sopen, unlock

 


Example :

#include <stdio.h> 

#include <fcntl.h> 

#include <io.h>


void main( )

{
    int     handle;

    char   buffer [20];


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

    if( handle != -1 ) {

        if( lock ( handle, 0L, 20L ) ) {
            printf( "Lock failed\n" );

        } else {
            read( handle, buffer, 20 );

            /* update the buffer here */

            lseek( handle, 0L, SEEK_SET );

            write( handle, buffer, 20 );

            unlock ( handle, 0L, 20L );

        }    
        close( handle );

    }

}

 

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