Example/* ACCESS.C: This example uses _access to check the * file named "ACCESS.C" to see if it exists and if * writing is allowed. */#include <io.h> #include <stdio.h> #include <stdlib.h>void main( void ) { /* Check for existence */ if( (_access( "ACCESS.C", 0 )) != -1 ) { printf( "File ACCESS.C exists\n" ); /* Check for write permission */ if( (_access( "ACCESS.C", 2 )) != -1 ) printf( "File ACCESS.C has write permission\n" ); } } OutputFile ACCESS.C exists File ACCESS.C has write permission ================================= o000() ( ★ ) \ ( \__)
Example/* ACCESS.C: This example uses _access to check the * file named "ACCESS.C" to see if it exists and if * writing is allowed. */#include <io.h> #include <stdio.h> #include <stdlib.h>void main( void ) { /* Check for existence */ if( (_access( "ACCESS.C", 0 )) != -1 ) { printf( "File ACCESS.C exists\n" ); /* Check for write permission */ if( (_access( "ACCESS.C", 2 )) != -1 ) printf( "File ACCESS.C has write permission\n" ); } } OutputFile ACCESS.C exists File ACCESS.C has write permission
* file named "ACCESS.C" to see if it exists and if
* writing is allowed.
*/#include <io.h>
#include <stdio.h>
#include <stdlib.h>void main( void )
{
/* Check for existence */
if( (_access( "ACCESS.C", 0 )) != -1 )
{
printf( "File ACCESS.C exists\n" );
/* Check for write permission */
if( (_access( "ACCESS.C", 2 )) != -1 )
printf( "File ACCESS.C has write permission\n" );
}
}
OutputFile ACCESS.C exists
File ACCESS.C has write permission
=================================
o000()
( ★ )
\ (
\__)
* file named "ACCESS.C" to see if it exists and if
* writing is allowed.
*/#include <io.h>
#include <stdio.h>
#include <stdlib.h>void main( void )
{
/* Check for existence */
if( (_access( "ACCESS.C", 0 )) != -1 )
{
printf( "File ACCESS.C exists\n" );
/* Check for write permission */
if( (_access( "ACCESS.C", 2 )) != -1 )
printf( "File ACCESS.C has write permission\n" );
}
}
OutputFile ACCESS.C exists
File ACCESS.C has write permission