home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 31
/
CDASC_31_1996_juillet_aout.iso
/
internet
/
wsplug31.zip
/
VCOPY.C
< prev
next >
Wrap
Text File
|
1996-02-06
|
775b
|
41 lines
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <share.h>
extern int errno;
main(argc,argv)
int argc;
char **argv;
{ int h,more=1 ;
if (argc < 2)
{ printf("Missing arguments ... \n");
printf("vcopy string filename\n");
return(0);
}
while(more)
{
h = sopen(argv[2],O_BINARY|O_CREAT|O_WRONLY|O_TRUNC,SH_DENYRW,S_IREAD|S_IWRITE);
if (h == -1)
{ if (errno != EACCES)
{ printf("Unable to Open %s...\n",argv[2]);
return(0) ;
}
else printf("Vcopy, File %s Permission Denied...\n",argv[2]);
}
else more=0;
}
if (argc > 2) write(h,argv[1],strlen(argv[1]));
close(h) ;
return(0);
}