Hello monks,
I am trying to read from the serial device.I have tied with file handler and i access through it's file handler functions.My buffer size is 512 and i try to read only 40 bytes.And then display the 40 bytes line by line.I knew the existence of readline function which does the same,but i don't want to use that.The bytes i read are,
hi\nhow are
u\nhello iam fine\n
\nthe world\n is ve
ry beautiful\n
And i write "wow" string on to the serial device once i read the string "hello".After sending the data i read other two lines
. In short, both TX and RX are taking place on serial port and i need to read 40(or whatever is available) number of bytes.My output should be as below
hi
how are u
wow
hello i am fine
the world is very beautiful
I was trying split function,but i am not getting the appropriate output when the new line character comes in the next line.Can anyone throw some light on this.It would also be fine if anyone can jus share the snippets
thanks

In reply to Implementation of Readline by shyam123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.