473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ReadFile problem(VC++)

friendjin
Expand|Select|Wrap|Line Numbers
  1. WriteFile(hCom1, "AT+CSQ\r", sizeof("AT+CSQ\r"), &dwWritten, &ovlw);
  2.     Sleep(50);
  3.                 COMMTIMEOUTS comto;  
  4.     comto.ReadIntervalTimeout = 10;  
  5.       comto.ReadTotalTimeoutMultiplier = 5000;  
  6.                 comto.ReadTotalTimeoutConstant = 0; //dwTimeoutMs;  
  7.                 comto.ReadTotalTimeoutMultiplier = 0;  
  8.       comto.WriteTotalTimeoutConstant = 5000;  
  9.       comto.WriteTotalTimeoutMultiplier = 0;  
  10.  
  11.     f(!SetCommTimeouts(hCom1, &comto))
  12.     {
  13.     fprintf(Err, "%s\n", "Fail to get the response from the modem.");
  14.     goto end;
  15.     }
  16.     int ReadError;
  17.     ReadFile (hCom1, &szBuffer, sizeof(szBuffer), &dwRead, &ovlr);
This is part of code, the problem is while the modem is connectting, it is working all right.but while the modem is not connect well, or other problem form the modem, the programe will be stopped on the ReadFile().I mean the programe could not be stopped untill getting the response but actually no response in this case as modem error.I tried to set a timeout to exist while this error happens, but it would not work. I don't know what the problem is.
Any idea?
Thanks.
Feb 23 '07 #1
0 1568

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Moi | last post by:
Hello, sorry if this has been asked over & over, in which case, please someone points me to the answer :) My situation: I've an ActiveX witten in VC++6, it has several methods returning a...
2
by: Armando | last post by:
i write one programm in vc++ but the compiler say that i use ambiguous symbol,i don´t know why ? how can do to tell the compiler that is ok so ? i become this error message: error C2872:...
6
by: Armando | last post by:
Hallo ! I habe some error in my programm,because i use <fstream.h>,I want to use <fstream> but i don´t know which fonctions i must modify in my program ? Thanks you for your help. Armando.
11
by: Tatu Portin | last post by:
Have this kind of struct: typedef struct { char **user_comments; /* ... */ } vorbis_comment; /* prototype */ char * read_vorbis_string ( FILE *sc);
0
by: Domingos Jr. | last post by:
Hello, I have a VC++ dialog that contains other child dialogs, and one of these child dialogs have checkboxes inside. When I'm using windows xp with some theme, the checkbox display only the...
8
by: MatthiasBiel | last post by:
Hi all, Microsoft Visual C++ .NET 69586-112-0293626-18840 doesn't compile the code below, it issues a C2146. template<class T> class A { public: typedef T X; };
0
by: Usman | last post by:
Hi there I'm having problem compiling my code. I have a library along with its header file that I've used in my Com project. On compilation I get this linking error. Does anyone have any idea...
0
friendjin
by: friendjin | last post by:
VC++.NET I am going to read some response from serialport after I write some into serial port(serial port connected to the Modem). Now, when I connect, the code is working well. the problem is:...
1
by: Derek =?utf-8?Q?Kuli=C5=84ski?= / takeda | last post by:
I spent many hours on this, googling around and experimenting, and still nothing. I wrote an umanaged program (actually various classes), while I was developing them I used command line to test...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.