The Easiest Way to Save and Share Code Snippets on the web

C code in a Perl script

perl | by: boernieat

posted: Feb, 7th 2012 | jump to bottom

#!/usr/bin/perl
use Inline "C";
 
my $err = 0;
 
if( $ARGV[0] eq "" ) {
        $err = 255;
} else {
        $err = check_share($ARGV[0]);
}
 
print $err;
 
__END__
__C__
 
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
 
int check_share(char* path) {
        size_t filedesc = open(path, O_RDONLY);
        return errno;
}
41 views