home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 32
/
hot34.iso
/
ficheros
/
DUTI
/
CASES002.ZIP
/
UCASE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1998-04-01
|
2KB
|
68 lines
//<c> Copyright 1995-1998 by Gerry J. Danen; all rights reserved.
//<t> Convert to all uppercase
//
// Usage: UCASE file_in file_out
//
// Full pathnames are supported for the filenames.
//
#include"gd_tools.h"
#define pgVERS_ "V1.10"
#define pgTITL_ "Convert to All Uppercase"
#define pgCOPR_ "1995"
#define BUFSIZE 10000
UCHAR iFile[FS_LEN], oFile[FS_LEN], work[BUFSIZE+2], *w ;
long lines = 0 ;
FILE *iFh, *oFh ;
void show_help_and_quit( void )
{
logon(1);
fprintf( stderr,
"\nThis program converts a file to all uppercase characters\n\n"
"\tUsage: %s file_in file_out\n\n", get_global_program_name() );
exit( GD_ERROR_HELP );
}
void main( int argc, char *argv[] )
{
tt_init( SHAREWARE_VERSION, 0, pgVERS_, pgTITL_, pgCOPR_ );
logon(0);
if ( argc != 3 )
show_help_and_quit();
st_cpy( iFile, (UCHAR *) argv[1], FS_LEN );
st_cpy( oFile, (UCHAR *) argv[2], FS_LEN );
strupr( (char *) iFile );
strupr( (char *) oFile );
if ( ( iFh = fopen( iFile, "r" ) ) == NULL )
{
logon(1);
fprintf( stderr, "\n\nFile %s not found\a\n", iFile );
show_help_and_quit();
}
oFh = fl_create_or_replace_tty( oFh, oFile, "w", YES, YES );
fprintf( stderr, "%s: reading %s ...", get_global_program_name(), iFile );
while ( (w = fgets( work, BUFSIZE, iFh )) )
{
strupr( work );
fprintf( oFh, "%s", work );
lines ++ ;
}
_fcloseall();
fprintf( stderr, " %ld lines\n", lines );
exit( GD_ERROR_NONE );
}