Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <dirent.h>
- #include <libgen.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <dlfcn.h>
- #include <link.h>
- void dalbut_readdir( DIR *dir, int fd );
- int dalbut_open_fd();
- int dalbut_open_fd(){
- int fd;
- fd = open( "f_info.txt", O_RDWR | O_CREAT | O_APPEND, 0644 );
- if( fd == -1){
- perror("f_info.txt");
- exit(1);
- };
- return fd;
- }
- void dalbut_readdir( DIR *dir ,int fd) {
- struct dirent *dp;
- int i = 0;
- while( (dp = readdir (dir)) != NULL ){
- printf("%3d. Vardas: %s\n%4s Nr. i-node: %i\n", ++i, dp->d_name, "", (int) dp->d_ino);
- void *asdd;
- if((asdd = dlopen(dp->d_name, RTLD_LOCAL)) == NULL){
- }else{
- printf("%s\n","dinamine biblioteka");
- }
- }
- }
- int main( int argc, char * argv[] ) {
- printf("%s\n","(C) 2019 D. Butrimas");
- int fd = dalbut_open_fd();
- DIR *dir;
- if ( (dir = opendir(argv[1])) == NULL ) {
- perror( "Cannot open ." );
- exit( 1 );
- }
- dalbut_readdir( dir, fd );
- printf("%s%s,%s\n","Informacija apie katalogo",argv[1],"suformota f_info.txt");
- if ( (closedir( dir )) != 0 ) {
- perror( "Failed to close .");
- exit( 1 );
- }
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement