Hi,

I have a serial port that is streaming data.  The data is terminated by a
/r only.
I am trying to use scanner.Scan () to break up the lines.  Is there a way
to change the scanner end of line character to /r only?

Thank you

config := &serial.Config {
Name:        lmt.ComPort,
Baud:        57600,
ReadTimeout: 30 * time.Second,
Size:        8,
}

stream, err = serial.OpenPort(config)
if err != nil {
fmt.Printf("ERROR - Can not open com port:%s\n", lmt.ComPort)
return
}

scanner := bufio.NewScanner(stream)

for scanner.Scan() {
bufStr := scanner.Text()
.
.
.
}

-- 
DanJ

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CACHdq71-3hNChDFEbsDEmNsTwU9HRV7aetDbjSK0kwchC87%3D6w%40mail.gmail.com.

Reply via email to