|
Is there any command that gets all the details of the device connected to the serial port ??
Actually i connect a smart card reader to a serial COM port, i send some data to it using WriteFile (), in return it gives some response, i read the response using ReadFile().
Now if i donot connect the reader and simply connect the serial cable to computers serial port i send the data to the handle of the serial port using WriteFile(), the computer(or ReadFile ()) waits infinitely for receiving response !
In order to solve above problem i use COMMTIMEOUTS, so if the specified time expires the ReadFile() executes successfully although it doesn't get the response!!
Actually i donot want to use COMMTIMEOUTS since i donot know the exact time in which the reader sends a response !!
if i use maximum delay it decreases the performance of my application, if i use completely less time delay, the ReadFile() expires even before it receives respone from the reader!!
so is there any other suggestion
|
|
|
|
|
kapardhi wrote: How to detect whether a device is connected to a Serial port (Re-Post,since not yet satisfied with given suggestions)
I think you'll have to re-post again and again. Good luck.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
For starters - check Wikipedia Serial Port
Here is the "link" with some extra characters added by this control:
<a href="http://en.wikipedia.org/wiki/Serial_port">http://en.wikipedia.org/wiki/Serial_port</a>[<a href="http://en.wikipedia.org/wiki/Serial_port" target="_blank" title="New Window">^</a>]
Your code needs to monitor the "handshake" signals of the serial communication protocol (RS232), i.e. hardware status, first before it attempts to read or write any actual data.
There is an older book dealing with serial communication in C, which covers this in details.
Sorry, don’t remember the exact title. Just Google it.
Cheers Vaclav
|
|
|
|
|
Hi all,
How do I know the number of occurences of a character from a string for example the "@" sign from email@email@email.com. I need to validate email addresses.
Thanks,
Jayjay
|
|
|
|
|
Count them.
Seriously though, are you kidding? After more than a year of asking programming questions here you can't figure this out by yourself? You should consider a career change.
modified on Thursday, October 16, 2008 5:29 AM
|
|
|
|
|
Michael Schubert: CodeProject's official career counselor.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
He he. I think not. John Simmons is much better at that. 
|
|
|
|
|
Michael Schubert wrote: You should consider a career change.
Any suggestions??
Regards,
Sandip.
|
|
|
|
|
This could get ugly. Maybe switching to Visual Basic?
|
|
|
|
|
Michael Schubert wrote: Maybe switching to Visual Basic?
Oh my God... You are the worst job counselor I have ever seen
|
|
|
|
|
I know. 
|
|
|
|
|
Yes, of course [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
That is interesting .. May be it will suit him..
BTW: Looks like this is another crime of THHB.
Regards,
Sandip.
|
|
|
|
|
SandipG  wrote: BTW: Looks like this is another crime of THHB.
Another one here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Call iteratively strchr [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
monsieur_jj wrote: I need to validate email addresses.
You need to validate the email address to have one and only one '@' character? OK, this code will do that:
const char *szEmail= "myname@mydoma@in.com";
strchr(szEmail,'@')?strchr(strchr(szEmail,'@')+1,'@')?cout<<"Invalid!":cout<<"Valid!":cout<<"Invalid!!"; Program Output: Invalid!
Error checking and any dodgy stuff must be handled by *you* of course.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
You could try:
string strEmail = "email@email@email.com";
count(strEmail.begin(), strEmail.end(), '@');
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
can anybody suggest how to get name of network adapter card if ip address is given in linux?I have to do it programmatically.
|
|
|
|
|
an89 wrote: can anybody suggest how to get name of network adapter card...
Try GetAdaptersInfo() . I doubt it'll work on Linux, however.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I think in linux
ioctl(socketid, SIOCGIFCONF, &ifc);
can be used.
I think you can also use function pcap_findalldevs in libpcap library(opensource).
alternatively you can also see the linux specific implementation of pcap_findalldevs in libpcap.
|
|
|
|
|
Thanks.... 
|
|
|
|
|
it won't work as its win32 api.
|
|
|
|
|
an89 wrote: ...as its win32 api.
That's what I would expect from a VC++ forum.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
You application will be displayed in the appliction tab of task manager only if you that application have created a window.
The project such as "win32 projects" in msdev wont create any window by defualt and so it will not be listed in application tab.
|
|
|
|