Christopher said:
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
FILE *fp;
if( (fp=fopen("~seema/TimerTest","r")) != NULL ) {
fclose( fp );
system( "~seema/TimerTest" );
}
return 0;
}
Failure to open a file for reading does not necessarily mean that the
file is not executable. Under Unix, for example, you can have execute-
only permissions (---x--x--x) on a program. Also, being able to open
a file for reading doesn't mean it's executable.
You probably need to go outside the realm of standard C, and use an
extension provided by the platform. For example, on Posix systems,
you can try access() or stat() to see if the file not only exists, but
that you can execute it.
And, I am also assuming that "~seema" is meant to be treated as the
Unix "seema's home directory" shortcut. This obviously requires more
system-specific extensions, such as getpwnam().
Perhaps comp.unix.programmer is a better place to find answers?
--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody |
www.hvcomputer.com | |
| kenbrody/at\spamcop.net |
www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:
[email protected]>