 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Morosh Guest
|
Posted: Thu Sep 07, 2006 6:10 pm Post subject: dialing a phone number |
|
|
Hello:
I like to dial a phone number in C++, is it possible??
thanks
Maurice |
|
| Back to top |
|
 |
Eangelo Guest
|
Posted: Thu Sep 07, 2006 8:06 pm Post subject: Re: dialing a phone number |
|
|
If you are using a standard modem, basically you have to open the COM port
to which the modem is connected, then to issue the following AT commands
(<CR> is the character 0xD, 13 decimal):
ATZ<CR>
wait for "OK" from the modem and then:
ATDT 0123456789;<CR>
Don't forget the character ";" (semicolon) after the number to dial,
otherwise the modem will try to connect in "data mode"
To terminate the call:
AT H0<CR>
Henry
"Morosh" <morisaab (AT) yahoo (DOT) fr> ha scritto nel messaggio
news:450019d6 (AT) newsgroups (DOT) borland.com...
| Quote: | Hello:
I like to dial a phone number in C++, is it possible??
thanks
Maurice
|
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Thu Sep 07, 2006 8:39 pm Post subject: Re: dialing a phone number |
|
|
Morosh wrote:
| Quote: | I like to dial a phone number in C++, is it possible??
|
Have a look at tapiRequestMakeCall().
Hans. |
|
| Back to top |
|
 |
Morosh Guest
|
Posted: Sat Sep 09, 2006 6:43 pm Post subject: Re: dialing a phone number |
|
|
"Eangelo" <eangelo (AT) libero (DOT) it> wrote in message
news:45003577$1 (AT) newsgroups (DOT) borland.com...
| Quote: | If you are using a standard modem, basically you have to open the COM port
to which the modem is connected, then to issue the following AT commands
(<CR> is the character 0xD, 13 decimal):
ATZ<CR
wait for "OK" from the modem and then:
ATDT 0123456789;<CR
Don't forget the character ";" (semicolon) after the number to dial,
otherwise the modem will try to connect in "data mode"
To terminate the call:
AT H0<CR
Henry
"Morosh" <morisaab (AT) yahoo (DOT) fr> ha scritto nel messaggio
news:450019d6 (AT) newsgroups (DOT) borland.com...
Hello:
I like to dial a phone number in C++, is it possible??
thanks
Maurice
|
Hi:
I have two modems: one internal connected to com3, and one usb external
connected to com4
(information from Device Manager)
I tried the following:
#include "stdio.h"
#include "bios.h"
void main()
{
int x;
FILE* comport;
if(!(comport=fopen("COM3:","w+")))
perror("COM3 not open.");
else
{
fputs("ATDT01555444333\n",comport);
}
if(comport) fclose(comport);
}
I compiled and the response is:
COM3 not open.: No such file or directory
(I tried both "com3" and "com3:" ), the same thing happens to com4
any idea??
thanks
Maurice |
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Sun Sep 10, 2006 7:51 pm Post subject: Re: dialing a phone number |
|
|
Morosh wrote:
| Quote: | I have two modems: one internal connected to com3, and one usb external
connected to com4
if(!(comport=fopen("COM3:","w+")))
perror("COM3 not open.");
COM3 not open.: No such file or directory
(I tried both "com3" and "com3:" ), the same thing happens to com4
|
"COM3" is correct
You might try using
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
}; |
|
| Back to top |
|
 |
Morosh Guest
|
Posted: Tue Sep 12, 2006 8:10 am Post subject: Re: dialing a phone number |
|
|
"Bob Gonder" <notbg (AT) notmindspring (DOT) invalid> wrote in message
news:in88g21pd7ivvo44c2no7a54kl7ii2sic0 (AT) 4ax (DOT) com...
| Quote: | Morosh wrote:
I have two modems: one internal connected to com3, and one usb external
connected to com4
if(!(comport=fopen("COM3:","w+")))
perror("COM3 not open.");
COM3 not open.: No such file or directory
(I tried both "com3" and "com3:" ), the same thing happens to com4
"COM3" is correct
You might try using
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
};
|
Hello:
thanks for clarifications
But which header file should be included in the beginning?
I tried "io.h", it didn't work.
I use always the free command line compiler.
that's what I've tried:
*******************************************
#include "stdio.h"
#include "io.h"
void main()
{
HANDLE h;
h = CreateFile( "COM3", GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if( h != INVALID_HANDLE_VALUE )
{ DWORD byteswritten;
WriteFile( h,"ATDT01555444333\r",
sizeof("ATDT01555444333\r")-1, &byteswritten, 0 )
/* also notice the change to \r */
CloseHandle( h );
}else{
//handle the error
};
}
Thanks
Maurice |
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Tue Sep 12, 2006 10:36 pm Post subject: Re: dialing a phone number |
|
|
Morosh wrote:
| Quote: | But which header file should be included in the beginning?
|
We are in the .nativeapi group.
Those functions are native Windows API functions.
The vast majority of Windows functions are available by including
windows.h.
#include <windows.h>
The headers for those that are not included by windows.h may be found
by looking at the documentation for the functions. MSDN is esspecially
good at that. http://msdn.microsoft.com/library/ |
|
| Back to top |
|
 |
Maurice Guest
|
Posted: Thu Sep 14, 2006 3:12 pm Post subject: Re: dialing a phone number |
|
|
"Bob Gonder" <notbg (AT) notmindspring (DOT) invalid> wrote in message
news:5hrdg2djn4a8onsagqjb7nr2mnjuqqkneq (AT) 4ax (DOT) com...
| Quote: | Morosh wrote:
But which header file should be included in the beginning?
We are in the .nativeapi group.
Those functions are native Windows API functions.
The vast majority of Windows functions are available by including
windows.h.
#include <windows.h
The headers for those that are not included by windows.h may be found
by looking at the documentation for the functions. MSDN is esspecially
good at that. http://msdn.microsoft.com/library/
Thanks very much, it worked!!!!!!!!!!!! |
Now, if you had time, I like to read the modem status to know if the ligne
is busy or not.
Any idea???
Thanks again
Maurice |
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Thu Sep 14, 2006 10:02 pm Post subject: Re: dialing a phone number |
|
|
Maurice wrote:
| Quote: | Now, if you had time, I like to read the modem status to know if the ligne
is busy or not.
Any idea???
|
After WriteFile() do a ReadFile() to read the response.
You would probably want to read single chars and build up a response
out of them because you don't know the size of the response ahead of
time. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|