Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 444629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:17:23+00:00 2026-05-12T21:17:23+00:00

I am implementing an SMTP-sender in C which is supposed to read a file

  • 0

I am implementing an SMTP-sender in C which is supposed to read a file from a directory whenever it is created, process data and delete the file.

How can I implement this polling function which should keep doing this automatically?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:17:23+00:00Added an answer on May 12, 2026 at 9:17 pm

    A simple option is to run your program periodically from cron. The program can use the Linux API call readdir to iterate through a directory. It doesn’t have to actively monitor the directory.

    Here’s a simple code example:

    #include <stdio.h>
    #include <sys/types.h>
    #include <dirent.h>
    int main()
    {
       DIR* dp = opendir(".");
       struct dirent* de;
       while (de = readdir(dp))
       { 
         if (de->d_type != DT_REG) // Only print regular files
            continue;
          printf("Found file %s\n", de->d_name);
       }
       closedir(dp);
    }
    

    Disclaimer: For the sake of simplicity I did not include code to check or handle error conditons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When implementing the Strategy Pattern, where does one put the code that determines which
When implementing a Matrix construct using arrays, which would be more efficient? Using a
Implementing ArrayAccess Interface in PHP , We can access Object Properties as Array Keys
I implementing OLE DB provider for my custom database. It will be used from
While implementing the code from this question on my project I realized there's 3
I'm looking at implementing CRAM-MD5 authentication for an IMAP and SMTP server. Problem is
Implementing equals() and hashCode() for simple data POJOs is cluttering my code and maintaining
I'm implementing a email newsletter sender service using .NET and Windows Server technologies. Are
I have a web application from which emails should be sent after specific actions.
When implementing DDD in an application which contains a lot of CRUD functionality, coupled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.