Jump to content
  • Advertisement
Sign in to follow this  


This topic is 4914 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote this function, which is supposed to poll a directory for new files. But when i execute it with await_write("testdir"); the first call to kevent returns -1 and sets errno to "No such file or directory" I have no idea what I'm doing wrong and i was hoping somebody here could help.
int await_write(char* dir)
  struct kevent kev;
  struct kevent retkev;
  DIR* dirp;
  int kq;
  int n;
  int dirdes;

  if((dirp = opendir(dir)) == NULL) {
    printf("failed to open directory.\n");
    return -1;
  dirdes = dirfd(dirp);

  kq = kqueue();

  if((n = kevent(kq, &kev, 1, NULL, 0, NULL)) == -1) {
    return -1;
  kevent(kq, NULL, 0, &retkev, 1, NULL);

  return 0;

[Edited by - branhield on June 2, 2005 7:09:09 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!