[Tutor] Splitting up the input

alan.gauld@bt.com alan.gauld@bt.com
Thu Jan 23 12:29:01 2003


> I want to read in infromation from the serial port. 

To some extent this will epend on your OS and machine architecture.

> The probem is i can take i the whole line but only want to read 
> it in in lumps of 9 characters. 

Assuming the data arrives in sensible line format then you might 
be best ton read the line into a buffer and then use slicing to 
access the data within it. If the data does not naturally arrive 
as a line then you may need to use the fctl or ioctl functions 
to read from the serial file decriptor the required number of 
bytes as they arrive in the buffer.

Alan g.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld/