473,902 Members | 3,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serial Port Access in XP

Hi,

I am trying to access Serial Port in XP. I am using Dev-C++ IDE that
uses Mingw as a compiler. I just want to know how I can open up serial
port on COM1 and write some data. I have searched quite a bit over the
web and could not find anything useful. I don't want to use Visual C++
or Cygwin, linux, etc. If any of you guys have some little tid bit of
code that would be great to look at.

Aug 31 '06
38 9684
In article <4l************ @individual.net >,
Default User <de***********@ yahoo.comwrote:
>nl******@gmail .com wrote:

>Being that it seems about half of the posts I see on comp lang c are
posts saying that the OP is off topic

Only to unobservant nitwits.
Good point. The reality is (a lot) closer to 100%.

I believe there was an actual instance of a post, written by a regular,
addressed to an outsider, that was actually useful to said outsider, I
think, back in 1997.

Sep 2 '06 #31
goose <lk************ @webmail.co.zaw rites:
Kenny McCormack wrote:
[snip]
Yes?
[snip]
No. Next question?
Please don't feed the troll.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 2 '06 #32
"nl******@gmail .com" <nl******@gmail .comwrites:
Keith Thompson wrote:
>My goals are to keep this newsgroup as useful as possible for those of
us who want to discuss the C programming language, and to help people
who ask questions here get the best possible answers.

Being that it seems about half of the posts I see on comp lang c are
posts saying that the OP is off topic, I don't see how useful it
actually is. I just think it's a way a couple people have of making
themselves feel big.
You're mistaken. I've explained why we do what we do here.
>Neither goal is served by having detailed discussions of Windows XP in
this newsgroup. There are newsgroups that are dedicated to Windows
programming, and they're full of experts on that subject.

Well gosh golly gee darn it - looks like I ruined your precious ol
newsgroup by providing an answer instead of telling somebody how he is
OT. I'm so terribly sorry.
>I did not call anybody's knowledge into question, except to say that
I'm not qualified to judge the solution that was posted. For all I
know, it may be the best possible solution to the OP's problem. But
nobody is perfect. For example, I make mistakes now and then, which
is why I wouldn't feel comfortable posting technical advice in a forum
where there are no experts who can catch my mistakes.

You implied I didn't know what I was talking about by saying he should
look elsewhere for the correct answer. Don't try to act innocent.
I did not imply that you don't know what you're talking about with
respect to serial port access in Windows XP. For all I know, you
could be an expert on the topic. If you know anything about it at
all, you almost certainly know more about it than I do.

He would have been better off posting his question in a more
appropriate forum. You would have been better off posting your answer
in a more appropriate forum.

Both the original question and your answering it here were
understandable errors, easily corrected. It's your stubborn
insistence that (a) I've implied that you advice was incorrect rather
than off-topic, and (b) that off-topic advice is appropriate that I
find annoying.
>I did not criticize the OP; I gave him my best advice on how to find a
solution to his problem.

I already gave him his solution, actually. You just told him to F off
from your precious newgroup.
I did no such thing. I offered him advice about where to find good
information. If that information happens to include the advice you
posted here, that's great.
>We have seen time and again people posting off-topic advice in this
newsgroup, and it frequently goes wrong. Sometimes the advice
contains serious errors that somebody here, just by chance, happens to
be able to correct. The solution is simple: redirect the question to
a forum full of experts on the topic. At times, I've done so *and*
offered to answer the question in the more appropriate newsgroup.

Pay attention to this newsgroup for a while, and you'll see that I'm
right.

I do pay attention to this newsgroup - and like I said, way too many
posts here are "google it" or "post in xyz group" or "what part of
'comp.lang.c' do you not understand?" or other nonsense like that.
>And I'll also point out that, unlike you, I did not feel the need to
be personally insulting while making these points.

Actually - I'm pretty sure you're the one that implied that I don't
know what I'm talking about.
I did no such thing. I suppose I can understand why you took it that
way, but it is not what I meant.

Think about this. Suppose someone came to you with a question about
serial port access in Windows XP. Suppose you didn't have time to
answer, but wanted to suggest an appropriate Usenet newsgroup for his
question. Would you advise him to post to comp.lang.c, or to a
Windows-specific newsgroup?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sep 2 '06 #33
In article <ln************ @nuthaus.mib.or g>,
Keith Thompson <ks***@mib.orgw rote:
>"nl******@gmai l.com" <nl******@gmail .comwrites:
>Keith Thompson wrote:
>>My goals are to keep this newsgroup as useful as possible for those of
us who want to discuss the C programming language, and to help people
who ask questions here get the best possible answers.

Being that it seems about half of the posts I see on comp lang c are
posts saying that the OP is off topic, I don't see how useful it
actually is. I just think it's a way a couple people have of making
themselves feel big.

You're mistaken. I've explained why we do what we do here.
Yes, you have. But, you see, the thing is, we think you are lying.

Same goes for Heathfield. You see, he can go on for pages and pages,
explaining the stock dogmatic position in gory, excruciating detail, but
we all still know he's just yanking our chains.

Sep 2 '06 #34
nl******@gmail. com said:
goose wrote:
<snip>
>The difference between you and them is that they
would rather a question be answered by a group of
experts in a field.

I don't feel a need to ask a group of people when one person has
already given me a good answer. But hey - that's just me.
Unfortunately, whilst it is often possible for Q to determine whether A's
answer is /bad/, it is not always possible to know whether it's /good/.
This is especially true in programming. For example:

Q: if I've got a number in text form, in a string, and I want it in numeric
form, how do I do that?
A: int i = (int)str;

Q knows enough about C to realise this is wrong. He might give it a whirl
anyway out of sheer desperation, but it's easily identifiable as a bad
answer (as is almost /any/ answer that includes a cast!).

But if it goes like this instead:

Q: if I've got a number in text form, in a string, and I want it in numeric
form, how do I do that?
A: int i = atoi(str);

then Q has received some advice which, when followed, certainly seems to
work. So how is he to know that it's bad advice? (Which it is.)

Had the question been asked in comp.windows.xp .whatever, then that might be
the only answer he gets. As far as he's concerned, it appears to be a
"good" answer. Nobody corrects it. Nobody nitpicks it. Maybe he even gets
two or three people suggesting it. But the /best/ answer he gets might well
be the one that goes "have you considered asking the folks in comp.lang.c?"
Because over in comp.lang.c we could not only give him the right answer to
the question but also explain why the answer he already received, whilst
beguilingly close, is not actually a good answer after all.

Horses for courses. C experts tend to stick around here, and Windows experts
tend to stick around Windows groups, and Linux experts stick around Linux
groups, and Mac experts te... well, you get the idea.

<snip>

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 2 '06 #35
On 1 Sep 2006 16:14:39 -0700, in comp.lang.c , "nl******@gmail .com"
<nl******@gmail .comwrote:
>Keith Thompson wrote:
>I did not call anybody's knowledge into question, except to say that
I'm not qualified to judge the solution that was posted.

You implied I didn't know what I was talking about
He did not. You imagined that.
>by saying he should
look elsewhere for the correct answer.
Which is absolutely correct.
>I did not criticize the OP; I gave him my best advice on how to find a
solution to his problem.

I already gave him his solution, actually.
Quite possibly, but thats unverifiable in comp.lang.c, since the
windows gurus don't hang out here..
>You just told him to F off from your precious newgroup.
Keith did no such thing. Stop being so foolishly hyperbolic.
>This is my last post in this thread that is not on the topic of
accessing the serial port from within C. I, unlike the rest of you, am
actually interested in helping people.
From your posts here to date, I disagree. You seem mainly interested
in defending your injured pride against imaginary attacks, and in
insulting the regulars.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Sep 2 '06 #36
nl******@gmail. com wrote:
Being that it seems about half of the posts I see on comp lang c are
posts saying that the OP is off topic,
Gross hyperbole.
This is my last post in this thread that is not on the topic of
accessing the serial port from within C.
Untrue.
but the overlapped aspect of it can be a bit tricky as it
requires a multi threaded application.
Untrue. I once wrote a serial port application using overlapped
I/O and it was single-threaded. In fact that was the reason for
using overlapped I/O -- so I did not have to use threads!
You implied I didn't know what I was talking about by saying he should
look elsewhere for the correct answer.
You inferred it. Big difference.

Now, why should anyone trust your answer over a bar of soap?
You have posted several false statements on this thread.
Further, you resist calls for the question to be asked on a
group where experts are present.

I can only conclude that you are trying to make yourself feel
big, by posturing as if you are helping someone, and are
afraid that you will be shown up as ignorant if a real expert
were to criticize your "answer".

Finally, you seem to be suggesting that it is OK for anyone to
ask a question anywhere on Usenet, and get an answer. If
that is so, why don't we just abolish the separate groups and
have one big group for all posts?

Amusingly, this shall be my last post on this thread that _is_
on the topic of Windows programming. If you want to take
me up on my comments about overlapped I/O then please
do so on an appropriate newsgroup.

Sep 4 '06 #37
"Old Wolf" writes:
>Being that it seems about half of the posts I see on comp lang c are
posts saying that the OP is off topic,

Gross hyperbole.
Yes, of course. This thread had 50 posts including yours. One of them is a
question, and one of them is a purported answer. The other 48 are bickering
of various kinds which are probably not helpful to the OP. Unless, as was
implied, he was too damn dumb to know, without being told, that there is
misinformation in some web links. Very possibly including the one he was
given here. I think most people are at least vaguely aware of the
possibility of misinformation without being told.

I am especially appalled at the implication that a team of vigilant, eagle
eyed, experts (all self appointed) are sitting over on the Windows
newsgroups ready to pounce on any link that contains bad information. The
only link monitoring I see going on all pertains to beginner tutorials.
Everything else gets off scot(sp?) free. *Posts* sometimes get checked,
not links.
Sep 4 '06 #38

Old Wolf wrote:
but the overlapped aspect of it can be a bit tricky as it
requires a multi threaded application.

Untrue. I once wrote a serial port application using overlapped
I/O and it was single-threaded. In fact that was the reason for
using overlapped I/O -- so I did not have to use threads!
I corrected myself on that already. I still think it's messy (at least
in my application) for it to not be multi-threaded. I also don't think
there's a way to guarantee no loss of incoming data if it's not
multi-threaded, if you're doing any sort of serious number crunching.
But what do I know - apparently I'm full of mis-information.

I've stated my peace on all topics except for serial port access in XP,
so I'm not going to be wasting bandwidth with a response to anything OT
in this thread.

-Mike

Sep 4 '06 #39

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
13224
by: willie | last post by:
Hi, I'm writing a program which requires the use of three serial ports and one parallel port. My application has a scanning devices on each port, which I can access fine with pyserial. However, I'm unsure of how exactly I should be designing the program, I thought I could use threading to start class: class scanner(Thread): def __init__(self,port):
1
1417
by: Otac0n | last post by:
Is there an standards-compliant way to access the serial port? I need this to potentially work on DOS 6/7 and *nix. Your help would be appreciated.
1
2029
by: Finn Ellermann | last post by:
How can I can Iget in to Com Port in C# and Pocket PC 2002/2003 can some one help me ? using Visuel C# .NET development system. Regards Finn finn@ellermann-fam.dk
0
2142
by: asam.reddy | last post by:
Hi, I am trying to read serial port using the MSComm control in VS.NET2003(referred from the VS6.0). I have the code already in VB6 which I am coding to C#.NET. After setting all the required settings of the COM1 Port Dim buffer As Variant Dim arr() As Byte
13
4846
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have been told it is not possible to access the serial ports from asp.net. The application is used to control custom hardware. The hardware is connected to a PC through serial ports. Our customer wants to control the hardware from a remote...
0
1050
by: hemant kamble | last post by:
Hi, I am Hemant working on one software which written in QBASIC in that Serial port is access as output mode and write some instruction which dump in printer. So How I can access the serial port in XP that should not change the printer command in VB. Thanks
0
11277
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9672
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8045
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5892
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6084
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4724
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4305
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.