c - Read failed with error msg "Invalid argument" -


i try read data 1 fd, failed error message"invalid argument!".

struct inotify_event eventhdr; int head_read_len = (int)read(ctx->fd, (void *)&eventhdr, sizeof(inotify_event));     if(head_read_len == -1){        _debug("read eventhdr failed!!!!\n");        perror("read eventhdr!"); //print "invalid argument."    }    else{        _debug("read eventhdr succeed!!!!, head_read_len:%d, name:%s\n", head_read_len, eventhdr.name);        lseek(ctx->fd, seek_cur, -head_read_len); 

}

notes:

  1. the struct inotify_event used inotify system call, man inotify more details.

  2. fd guaranteed valid inotify file descriptor.

what seems problem? valuable insights?

the reason that: fd of inotify system call can not partially read.otherwise, return "invalid argument"!

use buffer large enough bytes!


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -