🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
9 messages
9 total messages Started by Morosh Thu, 07 Sep 2006 13:10
dialing a phone number
#3002
Author: Morosh
Date: Thu, 07 Sep 2006 13:10
5 lines
904 bytes
Hello:

I like to dial a phone number in C++, is it possible??
thanks
Maurice
Re: dialing a phone number
#3003
Author: Eangelo
Date: Thu, 07 Sep 2006 15:06
30 lines
1614 bytes
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@yahoo.fr> ha scritto nel messaggio
news:450019d6@newsgroups.borland.com...
> Hello:
>
> I like to dial a phone number in C++, is it possible??
> thanks
> Maurice
>
>
>
Re: dialing a phone number
#3004
Author: Hans Galema
Date: Thu, 07 Sep 2006 15:39
7 lines
1096 bytes
Morosh wrote:

> I like to dial a phone number in C++, is it possible??

Have a look at tapiRequestMakeCall().

Hans.
Re: dialing a phone number
#3005
Author: Morosh
Date: Sat, 09 Sep 2006 13:43
69 lines
2328 bytes
"Eangelo" <eangelo@libero.it> wrote in message
news:45003577$1@newsgroups.borland.com...
> 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@yahoo.fr> ha scritto nel messaggio
> news:450019d6@newsgroups.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
Re: dialing a phone number
#3012
Author: Bob Gonder
Date: Sun, 10 Sep 2006 14:51
27 lines
1802 bytes
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
};
Re: dialing a phone number
#3019
Author: Morosh
Date: Tue, 12 Sep 2006 06:51
61 lines
2525 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:in88g21pd7ivvo44c2no7a54kl7ii2sic0@4ax.com...
> 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
Re: dialing a phone number
#3022
Author: Bob Gonder
Date: Tue, 12 Sep 2006 17:36
14 lines
1591 bytes
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/
Re: dialing a phone number
#3036
Author: Maurice
Date: Thu, 14 Sep 2006 10:12
30 lines
1805 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:5hrdg2djn4a8onsagqjb7nr2mnjuqqkneq@4ax.com...
> 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
Re: dialing a phone number
#3037
Author: Bob Gonder
Date: Thu, 14 Sep 2006 17:02
12 lines
1546 bytes
Maurice wrote:

>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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads