Article View: borland.public.cppbuilder.nativeapi
Article #3019Re: dialing a phone number
From: Morosh
Date: Tue, 12 Sep 2006 06:51
Date: Tue, 12 Sep 2006 06:51
61 lines
2525 bytes
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
Technical Details
Message-ID:
<450659cf@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<450019d6@newsgroups.borland.com> <45003577$1@newsgroups.borland.com> <4502c609@newsgroups.borland.com> <in88g21pd7ivvo44c2no7a54kl7ii2sic0@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ff63fb968e41f36a X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Morosh" <morisaab@yahoo.fr> Newsgroups: borland.public.cppbuilder.nativeapi References: <450019d6@newsgroups.borland.com> <45003577$1@newsgroups.borland.com> <4502c609@newsgroups.borland.com> <in88g21pd7ivvo44c2no7a54kl7ii2sic0@4ax.com> Subject: Re: dialing a phone number Date: Tue, 12 Sep 2006 09:51:13 +0300 Lines: 64 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 213.175.188.149 Message-ID: <450659cf@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1158044111 213.175.188.149 (11 Sep 2006 23:55:11 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail