LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-24-2009, 09:07 AM   #1
payu21
LQ Newbie
 
Registered: Apr 2009
Location: australia
Posts: 12

Rep: Reputation: 0
Question TO write to a serial port


Hi all,


Can anyone tell me the command to write and read data i.ei send & receive data from a computer to a 9 pin serial port in C language????????

thanks,
pall
 
Old 05-24-2009, 09:23 AM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,094
Blog Entries: 2

Rep: Reputation: 111Reputation: 111
In the end its just another file descriptor so most file commands will work on it. If you just want to do command line stuff, I'd use setserial to set up the parameters you want (baud rate, parity, stop bits, ...) and then use whatever to read and write the device file (cat, echo, netcat, socat, ...). Or just use a program like minicom.

If you want to write a C program to do it you'll need to look at tcgetattr and tcsetattr for getting the serial info and setting it up how you want.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem to write to serial port os2 Programming 7 05-10-2013 04:33 PM
is there any shell command to read and write data from parallel and serial port? baosheng Linux - Hardware 2 01-13-2007 08:35 PM
Should be dead simple - read/write serial port from bash ericcarlson Linux - Software 3 10-21-2006 08:35 PM
How do i write to a serial port (modem) in ascii or hex directly? Taliesin.duchaos Linux - Networking 6 04-21-2006 08:31 AM
Serial port Read Write SeanatIL Programming 2 07-14-2004 03:42 PM


All times are GMT -5. The time now is 01:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration