473,406 Members | 2,387 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,406 software developers and data experts.

C-FAQ 19.7

This is what is there now (2006, 20 Dec)

How can I do serial (``comm'') port I/O?

It's system-dependent. Under Unix, you typically open, read, and write a
device file in /dev, and use the facilities of the terminal driver to
adjust its characteristics. (See also questions 19.1 and 19.2.) Under
MS-DOS, you can use the predefined stream stdaux, or a special file like
COM1, or some primitive BIOS interrupts, or (if you require decent
performance) any number of interrupt-driven serial I/O packages. Several
netters recommend the book C Programmer's Guide to Serial
Communications, by Joe Campbell.

---------------

I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.

The proposed replacement text is below:

It's system-dependent. Under Unix, you typically open, read, and write a
device file in /dev, and use the facilities of the terminal driver to
adjust its characteristics. (See also questions 19.1 and 19.2.)

Under windows (Win32) you can use the primitives CreateFile, ReadFile,
and WriteFile to open a serial communications port, and read/write
to/from it. For more information see:

http://msdn.microsoft.com/library/de...sdn_serial.asp
Dec 21 '06
56 2701
Sorry, all, I only just now encountered this thread. (Those
harboring dark suspicions that the FAQ list maintainer does not,
in fact, monitor the group regularly any more, and that when he
does it's usually by kibozing, are all too accurate.)

A few more points and clarifications beyond those already offered
by others:

jacob navia wrote:
>>>>>>>>>>>I would eliminate all references to MSDOS, a system that is
>>>>>>>obsolete since more than a decade now.
>>>>>>>>
>>>>>>>The proposed replacement text is below...
Richard Heathfield wrote:
>>>>>>>>>>It is... reasonable to add a reference to a Windows technique,
>>>>>>as you suggest.
Indeed. Thanks for your contribution, Jacob. I agree that the
various MS-DOS references are getting sort of hoary-looking.
>>>>>>>>>There are also Mac OS7 users, VAX VMS, and many others.
>>>>>Why should we reference MSDOS only?
>>>>>
>>>>A fair point. If C experts who are familiar with those systems would
>>>>care to document how to do serial I/O, no doubt Steve Summit will be
>>>>happy to incorporate their advice in the FAQ.
Richard "the mind reader" Heathfield has echoed my thoughts exactly.
(The careful reader will already have noticed that there *are*
some VAX/VMS details mentioned in 19.1...)

Random832 wrote:
>>>>>>>Who wrote the FAQ? If it was Mr. Summit, why did it become
>>>"our" faq? If it was _not_ Mr. Summit, why does he have sole
>>>control over it and the right to publish it in a book for a profit?
I wrote virtually all of the words in it, with the exception
of some by acknowledged friends who offered suggestions with the
understanding that I'd use them, and three or so verbatim quotes
(such as the one in 11.35) which are both attributed and used
with permission.

In particular, the wording of all the questions is also mine,
mostly in order to keep them succinct, although this has had the
side benefit that I get to duck criticisms that I've set someone
up for ridicule or violated their copyright (and yes, this did
happen, once.)

Why do I have the right to publish it as a book for a profit?
What does comp.lang.c get out of that deal? Was this a
barefaced, soul-destroying, community-robbing sell-out on my part?
Believe me, those questions (that is, the possibility that they
might one day be asked) haunted me as I was consummating the
Addison-Wesley deal.

I have the right to publish it because all the words are mine
and, to be blunt, I put a hell of a lot of work into them.
But comp.lang.c got a lot out of the deal as well. I insisted
on this, and Addison-Wesley was glad to acquiesce.

The HTML conversion came out of the book effort; I might well
never have gotten around to that conversion otherwise. The FAQ
list grew in size by a factor of about five during the book
publication effort, and a lot of that work "cross pollinated" the
free, posted version as well; the posted version grew by a factor
of about two as a result. (And there's been more, book-related
growth since then.)

I spent about half of 1995 working pretty much full-time on the
FAQ list. That amount of effort would never have been possible
without the book deal. But I decided that the newsgroup was
getting enough out of it that the "sell-out" was worth it.
>>>>>>>Why don't Mark Brader, Joe Buehler, Christopher Calabrese,
>>>Stephen M. Dunn, Tony Hansen, Guy Harris, Karl Heuer,
>>>Blair Houghton, Kirk Johnson, Andrew Koenig, John Lauro,
>>>Christopher Lott, Rich Salz, Joshua Simons, and Erik Talvola,
>>>get any say?
They have just as much say as they ever did, which is: a lot.
Anybody who sends in suggestions gets all due consideration,
and credit if the suggestion is used. (I had only one big fight
with my editor as the book was going to print: she felt that the
gargantuan list of acknowledgements in the preface was unwieldy,
and she was right, but I insisted on keeping it, because I wanted
to give everyone credit who had contributed anything at all.)

jacob navia wrote again:
>>>>>>now that I know I will write to Mr Summit and propose the change.
Did you? It doesn't look like I ever received your mail.
(But yes, these days I'm unfortunately more likely to see and
respond to emailed suggestions than newsgroup postings.)

Eric Sosman wrote:
>>>>>Random832 wrote:
>This faq, which is apparently the sole property of Mr. Summit,
>
... who wrote it, assembled it, revised it, corrected it,
re-wrote it, and has maintained it on-line for years and years.
Just under one year ago, after this long history of abusive
behavior, he had the gall to give the FAQ both a face-lift and
a better-connected Net-home and offer it to c.l.c. as a Christmas
present.
Which I'm paying for, by the way (DNS registration and hosting)
out of my own pocket. (But I'm not asking for sympathy or
donations or anything; it *is* my gift, freely given, and anyway
there's all those rapacious book royalties to help offset the
hosting costs. :-) )
>>>>For some reason, I'm not upset. Not in the least. He did
the work, he gets to reap the reward and retire rich. (Last I
heard, the print version was an Oprah selection and movie rights
were being negotiated; rumor has it that Undefined Behavior will
be played by Johnny Depp.)
We're still trying to decide whether to use Jim Carrey or Jack
Nicholson as the Null Pointer. Maddeningly, Gwyneth Paltrow
will not return my calls -- I had hoped to give her a shot at
the Struct Hack, but time is running out, so Carrie-Anne Moss
(who was everybody else's choice anyway) may get the role instead.
>>>Why does it say it was first composed in 1990 when the version on
record as being posted in 1990 has a copyright date of 1988?
I think I composed the very first draft (it was all of seven or
eight questions long) in late 1988. But due to a conflict (see
below) I didn't end up posting anything until a year and a half
later. Eventually I guess I decided that retaining the 1988 date
was silly, so I dropped it, since nothing got seen publicly then.
>>>I just want to know why it's "his" FAQ instead of "our" FAQ, and,
since it's _not_ "our" FAQ, why it's the "comp.lang.c FAQ". Is that
really such an unreasonable thing to ask? Why is it not called "Steve
Summit's C Programming FAQ"?
My goodness. I would never have dreamed of trying to put my name
on it like that. I did write it, but it's not mine; it owes
hugely to comp.lang.c. All the questions were inspired by actual
comp.lang.c questions; comp.lang.c is the filter which lets us
find out what the beginners are *really* having trouble with,
regardless of how the experts think the topics should be
explained, and despite the best efforts of all the textbook
authors and course instructors out there. As the introduction
says, the FAQ List "still retains the flavor of a good
comp.lang.c discussion".
>>>Is there a legitimate reason why, if he were to disappear or stop
maintaining or stop posting the faq, why shouldn't anyone else be
allowed to pick it up without starting over from scratch? What if
he gets hit by a bus?
I've identified two friends who will decide what to do with the
FAQ list if that happens. (And I've even mentioned this to one
of them.)
>>>What ever happened to Chris Torek's "FAQ Database" which is referred
to in one post in 1989 before the first google instance of the
current faq? Is it the same faq or was it an unrelated one?
I don't remember a database like that with Chris's name on it.
(Chris has since posted his recollections.) There was an effort,
announced by Raymond Chen (then at UCB) in 1989, to collect
user-contributed Q/A pairs which he was going to collate and post.
This happened after I'd started writing my nascent list but
before I'd, like, actually told anybody about it or anything.
I was sort of disappointed, but then in 1990 when Ray posted
that he hadn't gotten many contributions and was abandoning the
effort, I could go ahead and present my work after all.
>>>I guess part of my issue is, no-one's explained satisfactorily
_how_ Steve Summit managed to obtain exclusive rights to the FAQ
in the first place.
I got the job the same way any Usenet FAQ list maintainer gets
the job: I just started doing it one day.

Keith Thompson wrote:
>>I think there was some discussion here about rights to the FAQ in
conjunction with the clc-wiki.net site (or maybe the discussion took
place on the wiki, which is currently down). I don't recall the
details, and I don't think any firm conclusions were reached. Since
a longer version of the FAQ is also published as a book, the folks
at Addison-Wesley would probably have something to say about it.
Actually, the folks at Addison-Wesley have already had their say:
the book contract (inked all the way back in 1994) gives me the
explicit right to cross-pollinate the posted-to-Usenet list with
the underwritten-by-Addision-Wesley improvements, and even to
post the entire text of the book to the web. (But it took me
another -- gulp -- ten years to actually exercise my rights on
that point.)

I love wikis; a wikified version of the FAQ list is a wonderful
idea. The clc-wiki folks and I never managed to complete that
effort (this was mostly my fault, and for no reason other than
that I sort of dropped the ball), and I gather from this thread
that the clc-wiki has run dry, but it's still a good idea.

Richard Bos wrote:
>>Keith Thompson wrote:
But the c-faq.com web site is much easier to search (since thankfully,
the FAQ is not posted to Usenet in HTML).

STM a Usenet article is easier to search than a website.
De gustibus non disputandum est.
Chacun à son goût.
Different strokes for different folks.
That's why there is, and will always be, both an HTML and
a flat-ASCII version. :-)
--
Steve Summit
sc*@eskimo.com
Jan 6 '07 #51
Hi steve

Nice to read from you.

I am sorry. I wanted to write you to inform you from this
discussion, then I got engaged in other stuff and I couldn't
write you. It is nice that you found this thread.

Count on me for any help writing this part of the FAQ.

jacob
Jan 6 '07 #52
>>>>Is there a legitimate reason why, if he were to disappear or stop
>>>>maintaining or stop posting the faq, why shouldn't anyone else be
allowed to pick it up without starting over from scratch? What if
he gets hit by a bus?
Just incidentally, that happened almost literally over at alt.usage.english.
Mark Israel wrote an excellent FAQ posting for that newsgroup and retained
copyright himself, but after his last update in 1997, he drifted away from
involvement with the newsgroup. And then in 2004 he was hit, not by a bus,
but by a pickup truck, and suffered brain damage that left him with aphasia.

Today the newsgroup has an associated web site (at alt-usage-english.org)
and things that Mark's FAQ list didn't cover are now posted there as
separate "FAQ supplement" items. It's an awkward way of doing things,
but the alternative was to start over from scratch.
I've identified two friends who will decide what to do with the
FAQ list if that happens. (And I've even mentioned this to one
of them.)
Good to hear.
--
Mark Brader "Clearly, neither Mark Brader nor
Toronto Steve Summit read the whole book..."
ms*@vex.net -- Greg Black

My text in this article is in the public domain.
Jan 6 '07 #53
Steve Summit wrote:
[...]
Eric Sosman wrote:
>>>>>[...] (Last I
>heard, the print version was an Oprah selection and movie rights
>were being negotiated; rumor has it that Undefined Behavior will
>be played by Johnny Depp.)

We're still trying to decide whether to use Jim Carrey or Jack
Nicholson as the Null Pointer. Maddeningly, Gwyneth Paltrow
will not return my calls -- I had hoped to give her a shot at
the Struct Hack, but time is running out, so Carrie-Anne Moss
(who was everybody else's choice anyway) may get the role instead.
May I put in a vote for Angelina Jolie as Padding Bits?

--
Eric Sosman
es*****@acm-dot-org.invalid
Jan 7 '07 #54
jacob navia wrote:
This is what is there now (2006, 20 Dec)

How can I do serial (``comm'') port I/O?

It's system-dependent. Under Unix, you typically open, read, and write a
device file in /dev, and use the facilities of the terminal driver to
adjust its characteristics. (See also questions 19.1 and 19.2.) Under
MS-DOS, you can use the predefined stream stdaux, or a special file like
COM1, or some primitive BIOS interrupts, or (if you require decent
performance) any number of interrupt-driven serial I/O packages. Several
netters recommend the book C Programmer's Guide to Serial
Communications, by Joe Campbell.

---------------

I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.
Reading/writing special files starting "COM" "LPT" "AUX" etc.
still works in Windows XP. (Many people consider this stupid,
but it is supported nonetheless). Some versions of Windows 98
even crashed if you tried to access a path like C:\com\com
using Windows Explorer.

Jan 8 '07 #55
2007-01-06 <en**********@eskinews.eskimo.com>,
Steve Summit wrote:
[...]
I did make a substantial effort to avoid being accusatory, since most of
the "problems" are really only problems in principle (with the
"principle" mainly, but not entirely, being "what if this were someone
else we didn't trust")
>>>>I just want to know why it's "his" FAQ instead of "our" FAQ, and,
since it's _not_ "our" FAQ, why it's the "comp.lang.c FAQ". Is that
really such an unreasonable thing to ask? Why is it not called "Steve
Summit's C Programming FAQ"?

My goodness. I would never have dreamed of trying to put my name
on it like that. I did write it, but it's not mine; it owes
hugely to comp.lang.c. All the questions were inspired by actual
comp.lang.c questions; comp.lang.c is the filter which lets us
find out what the beginners are *really* having trouble with,
regardless of how the experts think the topics should be
explained, and despite the best efforts of all the textbook
authors and course instructors out there. As the introduction
says, the FAQ List "still retains the flavor of a good
comp.lang.c discussion".
I guess I think that a FAQ should be community-maintained - one reason
is, as you've mentioned, the fact that you don't regularly read the
group anymore.
I got the job the same way any Usenet FAQ list maintainer gets
the job: I just started doing it one day.
Fair enough.
Actually, the folks at Addison-Wesley have already had their say:
the book contract (inked all the way back in 1994) gives me the
explicit right to cross-pollinate the posted-to-Usenet list with
the underwritten-by-Addision-Wesley improvements, and even to
post the entire text of the book to the web. (But it took me
another -- gulp -- ten years to actually exercise my rights on
that point.)
So what rights do _they_ have, then? Exclusive right to publish it in
print form only, or can they prevent you from sublicensing the material
to allow others to modify/distribute it? Though, I guess the fact that
they agreed to such a contract means either A: they'd be cool with it
anyway if you asked or B: it was 1994, they didn't know how big this
"internets" thing would become
I love wikis; a wikified version of the FAQ list is a wonderful
idea. The clc-wiki folks and I never managed to complete that
effort (this was mostly my fault, and for no reason other than
that I sort of dropped the ball), and I gather from this thread
that the clc-wiki has run dry, but it's still a good idea.
It is a wiki. You could, you know, just start posting it. Or declare
that others can. You could say right now "feel free to take anything
from the FAQ and incorporate it into the wiki", with attribution if you
want it to be, specify a license, etc.
Richard Bos wrote:
>>>Keith Thompson wrote:
But the c-faq.com web site is much easier to search (since thankfully,
the FAQ is not posted to Usenet in HTML).

STM a Usenet article is easier to search than a website.

De gustibus non disputandum est.
Chacun à son goût.
Different strokes for different folks.
That's why there is, and will always be, both an HTML and
a flat-ASCII version. :-)
Jan 12 '07 #56
2007-01-08 <11**********************@s80g2000cwa.googlegroups .com>,
Old Wolf wrote:
jacob navia wrote:
>This is what is there now (2006, 20 Dec)

How can I do serial (``comm'') port I/O?

It's system-dependent. Under Unix, you typically open, read, and write a
device file in /dev, and use the facilities of the terminal driver to
adjust its characteristics. (See also questions 19.1 and 19.2.) Under
MS-DOS, you can use the predefined stream stdaux, or a special file like
COM1, or some primitive BIOS interrupts, or (if you require decent
performance) any number of interrupt-driven serial I/O packages. Several
netters recommend the book C Programmer's Guide to Serial
Communications, by Joe Campbell.

---------------

I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.

Reading/writing special files starting "COM" "LPT" "AUX" etc.
still works in Windows XP. (Many people consider this stupid,
but it is supported nonetheless). Some versions of Windows 98
even crashed if you tried to access a path like C:\com\com
using Windows Explorer.
Didn't some versions of XP?
Jan 12 '07 #57

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

Similar topics

19
by: Diego Andres Alvarez Marin | last post by:
Hi all! Is there a linux tool that uses as input my ugly C/C++ code and outputs a pretty and nice formated source code? Regards, Diego
19
by: Hal Styli | last post by:
Hello, Can someone please help. I need to use a large array and I'm not sure when one should use (A) and when one should use (B) below:- #define MAX 10000000 (A) int x;
46
by: Matt Gostick | last post by:
Well, it's not useless, it just doesn't seem to be working for me. Basically, when I'm returning a pointer from a function, free does not seem to be freeing the memory for me. Here is an example...
15
by: ccwork | last post by:
Hi all, In CFAQ 3.1, it says: A: Under my compiler, the code int i = 7; printf("%d\n", i++ * i++); prints 49. Regardless of the order of evaluation, shouldn't it print 56?
11
by: AC | last post by:
Is the following code valid? #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { int a; char s;
65
by: Giannis Papadopoulos | last post by:
Although Steve Summit's C FAQ is really good, are there any C FAQ wikis? -- one's freedom stops where others' begin Giannis Papadopoulos http://dop.users.uth.gr/ University of Thessaly...
22
by: omar khan | last post by:
Any books that helped you progress in C programming? Where do you begin with C programming? Can you recommend any websites? How many months or years did it take you to become knowledge to...
0
by: Audrey Pratt | last post by:
Happy Holidays to you and allow us to play Santa this year with these awsome deals that in anyway you can refuse: 2000 Web Templates for only $18.00 (Savings Over $1,000.00) ...
23
by: Anunay | last post by:
Hi all, Suppose a text file is given and we have to write a program that will return a random line from the file. This can be easily done. But what if the text file is too big and can't fit...
11
by: Thomas Lumley | last post by:
One of the examples in q13.20 in the FAQ (http://c-faq.com/lib/sd16.html, linked from http://c-faq.com/lib/gaussian.html) seems to be wrong. The full code is at that link. The part of the code...
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:
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
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...
0
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...
0
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...

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.