I am making a C program to send AT commands to a mobile phone from my pc. In that, I want it to dial a number but after a delay of some time say 10 minutes. How should I do this(I am using WriteFile command to send the dial command ATD)? Also, during this time delay I want to be able to do something else & when the time is up, I want the program to interrupt my current task so that it can dial the given number. Please tell me how I can do this.
champnim
6
Light Poster
Recommended Answers
Jump to Post__Unix-specific answer; I've not tried this kind of thing in Windows before__
It sounds like you can just fork it, sleep the child process for however long you need, and then dial out; Depending on how you wrote it the parent process could just continue on happily or maybe …
Jump to PostIn MS-Windows you will probably want to have two threads -- one thread for dialing and the other thread to do other things. The Sleep(int milliseconds) is available from windows.h
Jump to PostOr if your main program runs in a loop you could use the time() function to check the current time against somesort of timemark:
time_t seconds; seconds = time (NULL); while (1) //this would be your mainloop { // if > 10 minutes if (time(NULL) - seconds …
All 11 Replies
agartrell
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
champnim
6
Light Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
champnim
6
Light Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
champnim
6
Light Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
champnim
6
Light Poster
champnim
6
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.