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

  1. 2021.10.08 Watcom C Library : remove, rename, rewind, rmdir, _rotl, _rotr

 

 

Watcom C Library Reference : remove, rename, rewind, rmdir, _rotl, _rotr

 

 

 

 

remove

 

Synopsis : #include <stdio.h> 

              int remove( const char *filename );



Description : The remove function deletes the file whose name is the string pointed to by filename.

 

 

Returns : The remove function returns zero if the operation succeeds, non-zero if it fails. When an error has occurred, errno contains a value indicating the type of error that has been detected.

 

 

Example :

#include <stdio.h>


void main( )

{
    remove( "vm.tmp" );

}

 

Classification : ANSI
Systems : All

 

 

 

 

 

 

rename

 

Synopsis : #include <stdio.h> 

              int rename( const char *old, const char *new );



Description : The rename function causes the file whose name is indicated by the string old to be renamed to the name given by the string new.

 

 

Returns : The rename function returns zero if the operation succeeds, a non-zero value if it fails. When an error has occurred, errno contains a value indicating the type of error that has been detected.

 

 

Example :

#include <stdio.h>


void main( )

{
    rename ( "old.dat", "new.dat" );

}

 

Classification : ANSI
Systems : All

 

 

 

 

 

 

rewind

 

Synopsis : #include <stdio.h> 

              void rewind( FILE *fp );

 


Description :  The rewind function sets the file position indicator for the stream indicated to by fp to the
beginning of the file. It is equivalent to 

        fseek( fp, 0L, SEEK_SET );

except that the error indicator for the stream is cleared.

 

 

Returns : The rewind function returns no value.

 

 

See Also : fopen, clearerr

 


Example :

#include <stdio.h>


static assemble_pass ( int passno )

{
    printf( "Pass %d\n", passno );

}

 

 

void main( )

{
    FILE     *fp;
   

    if( (fp = fopen( "program.asm", "r")) != NULL ) {
        assemble_pass( 1 );

        rewind( fp );

        assemble_pass( 2 );

        fclose( fp );

}

 

Classification : ANSI
Systems : All

 

 

 

 

 

 

rmdir

 

Synopsis : #include <sys\types.h> 

              #include <direct.h>

              int rmdir( const char *path );

 


Description : The rmdir function removes (deletes) the specified directory. The directory must not contain any files or directories. The path can be either relative to the current working directory or it can be an absolute path name.

 

 

Returns : The rmdir function returns zero if successful and -1 otherwise.

 

 

See Also : chdir, chmod, getcwd, mkdir, stat

 


Example :

To remove the directory called \watcom on drive C:

 

#include <sys\types.h> 

#include <direct.h>


void main( )

{
    rmdir( "C:\\watcom" );

}


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

 

Classification : POSIX 1003.1
Systems : All

 

 

 

 

 

 

_rotl

 

Synopsis : #include <stdlib.h> 

              unsigned int _rotl( unsigned int value, unsigned int shift );

 


Description : The _rotl function rotates the unsigned integer, determined by value, to the left by the number of bits specified in shift. If you port an application using _rotl between a 16-bit and a 32-bit environment, you will get different results because of the difference in the size of integers.

 

 

Returns : The rotated value is returned.

 

 

See Also : _lrotl, _lrotr, _rotr

 


Example :

#include <stdio.h> 

#include <stdlib.h>


unsigned int mask = 0x0F00;


void main( )

{
    mask = _rotl( mask, 4 );

    printf( "%04X\n", mask );

 

 

produces the following :
F000

 

Classification : WATCOM
Systems : All

 

 

 

 

 

 

 

_rotr

 

Synopsis : #include <stdlib.h> 

              unsigned int _rotr( unsigned int value, unsigned int shift );


Description : The _rotr function rotates the unsigned integer, determined by value, to the right by the
number of bits specified in shift. If you port an application using _rotr between a 16-bit and a 32-bit environment, you will get different results because of the difference in the size of integers.

 

 

Returns : The rotated value is returned.

 

 

See Also : _lrotl, _lrotr, _rotl

 


Example :

#include <stdio.h> 

#include <stdlib.h>


unsigned int mask = 0x1230;


void main( )

{
    mask = rotr( mask, 4 );

    printf( "%04X\n", mask );

}

 


produces the following :
0123

 

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