Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop termios.h from adding \xOD

Status
Not open for further replies.

sharvey99

Programmer
Aug 24, 2000
16
GB
I have a script which uses termios.h to access the serial port of a SUN Sparc (/dev/term/b). The script uses the following code snippet to send via the tty.

$msg = "C2 RICE OK?\cJ";
$written = syswrite (PORT,$msg,12,0);

(PORT being the term filehandle)

Using a scope I have found that which ever incantation of \xOA or ^J I use, I always seem to send \0D\0A or crlf.
It appears that the code running the serial connection always prepends lf with cr. Anyone got any ideas how to stop this.
 
You could try binmode'ing the PORT filehandle to raw format.
Code:
binmode PORT, ':raw';
# or just
binmode PORT;
# since :raw is the default
This shouldn't make any difference on a Sparc but it's something to try.
If that doesn't work (which it probabaly won't) then the termios structure has several fields which you can set to control how linefeeds are handled. Just google 'termios.h'.

jaa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top