We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

The read fonction in Borland C++ Builder

Seb
Seb asked
on
Medium Priority
241 Views
Last Modified: 2010-04-02
Hi!,
        I have to read on the serial port in Hyper-console mode.  I use the read fonction:
read(IDcom2,&szCommandString,1);  where IDcom2 is the handle, obtain with the open fonction, szCommandString is my buffer and i have just 1 charactere on my serial port. szCommandString is a char [256].  The Compilation is OK, but when I execute my program, the program stopped at the read fonction?? and I don't no why?

Can you help me?
Comment
Watch Question

Commented:
It probably depends on how the serial port "file" has been set.  If it is set to do blocking I/O, the read() function will wait until enough bytes have come into the serial port to fill the request.  If that is the case and if no bytes come in, read() won't return.

Commented:
You might want to try using the windows API procedures to read from the serial port.  You can set the serial port "file" to have specific desired wait options.  I can elaborate if you are interested in that route.
Seb

Author

Commented:
OK thanks,

   If you can elaborate about API procedures, I'll be very happy...because I not really know this windows applications.

Thank you in advance!
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Seb

Author

Commented:
Ok thank you very much for your answer, I'll tchek that and ask you again if i have another questions...

Bye  Seb

Commented:
In the future always make sure an answer works and you have all the necessary information before accepting an answer.  That way if a problem comes up you can reject the answer and get more help from other experts.  I don't think there will be a problem here, but you never know.
Seb

Author

Commented:
Ok
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.