Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b293cf61b174f6cb974e48c9096dc9b3 > files > 616

lib64commoncpp-devel-1.8.1-7.mga4.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>GNU CommonC++: serialmain.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">GNU CommonC++
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">serialmain.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><span class="comment">/**********************************************************************</span></div>
<div class="line"><span class="comment"> * C/C++ Source: main.cc</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Test harness for the serialecho class</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * @author:  Gary Lawrence Murphy &lt;garym@teledyn.com&gt;</span></div>
<div class="line"><span class="comment"> * Copyright:  2000 TeleDynamics Communications Inc (www.teledyn.com)</span></div>
<div class="line"><span class="comment"> ********************************************************************</span></div>
<div class="line"><span class="comment">*/</span></div>
<div class="line"><span class="comment">// Copyright (C) 1999-2000 Teledynamics Communications Inc.</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// This program is free software; you can redistribute it and/or modify</span></div>
<div class="line"><span class="comment">// it under the terms of the GNU General Public License as published by</span></div>
<div class="line"><span class="comment">// the Free Software Foundation; either version 2 of the License, or</span></div>
<div class="line"><span class="comment">// (at your option) any later version.</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// This program is distributed in the hope that it will be useful,</span></div>
<div class="line"><span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div>
<div class="line"><span class="comment">// GNU General Public License for more details.</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// You should have received a copy of the GNU General Public License</span></div>
<div class="line"><span class="comment">// along with this program; if not, write to the Free Software</span></div>
<div class="line"><span class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// Created 2000/10/14 10:56:35 EDT by garym@teledyn.com</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#include &quot;serialecho.h&quot;</span></div>
<div class="line"><span class="preprocessor">#ifndef WIN32</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#include &lt;cstdlib&gt;</span></div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
<div class="line">{</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;Serial Echo to TCP Sessions&quot;</span> &lt;&lt; endl;</div>
<div class="line">  SerialEcho *modem = NULL;</div>
<div class="line">  <span class="keywordflow">try</span> {</div>
<div class="line">        modem = <span class="keyword">new</span> SerialEcho(<span class="stringliteral">&quot;/dev/modem2&quot;</span>);</div>
<div class="line">  } <span class="keywordflow">catch</span> (SerialEcho::xError *e) {</div>
<div class="line">        cout &lt;&lt; <span class="stringliteral">&quot;Modem Error; aborting&quot;</span> &lt;&lt; endl;</div>
<div class="line">        ::exit(1);</div>
<div class="line">  } <span class="keywordflow">catch</span> (Serial *e) {</div>
<div class="line">        cout &lt;&lt; <span class="stringliteral">&quot;Serial Error: &quot;</span></div>
<div class="line">                 &lt;&lt; modem-&gt;getErrorString()</div>
<div class="line">                 &lt;&lt; <span class="stringliteral">&quot;; aborting&quot;</span></div>
<div class="line">                 &lt;&lt; endl;</div>
<div class="line">        ::exit(1);</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <span class="keywordtype">char</span>* b = <span class="keyword">new</span> <span class="keywordtype">char</span>[modem-&gt;getBufferSize()];</div>
<div class="line"></div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;Modem code:&quot;</span> &lt;&lt; modem-&gt;start() &lt;&lt; endl;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">while</span> (cin &gt;&gt; b, b[0]) {</div>
<div class="line"></div>
<div class="line">        *modem &lt;&lt; b &lt;&lt; <span class="stringliteral">&quot;\r&quot;</span> &lt;&lt; endl;</div>
<div class="line"></div>
<div class="line">        cout &lt;&lt; <span class="stringliteral">&quot;sent: &quot;</span> &lt;&lt; b &lt;&lt; endl;</div>
<div class="line">        memset( b, 0, <span class="keyword">sizeof</span>(b));</div>
<div class="line"></div>
<div class="line">  }</div>
<div class="line">  cout &lt;&lt; <span class="stringliteral">&quot;fin&quot;</span> &lt;&lt; endl;</div>
<div class="line"></div>
<div class="line">  <span class="keyword">delete</span> [] b;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
<div class="line"></div>
</div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Oct 17 2013 23:24:56 for GNU CommonC++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>