trickwong / xgcom

Automatically exported from code.google.com/p/xgcom
GNU General Public License v2.0
0 stars 0 forks source link

strlen 不能正确计算中间有\0的字符串----bug #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
strlen 
不能正确计算中间有\0的字符串,就是串口收到一个中间带'\0
'的字符串,显示的时候后面的就都没有了。

--- Serie.c(版本 19)
+++ Serie.c(工作副本)
@@ -241,7 +241,7 @@
 perror("read error:\n");
 return -1;
 }
-len = strlen(frame);
+len = ret;
 debug_p("read_uart frame:%s len: %d\n", frame, len);
 if (uart_stat == 0) return -1;
 if (is_hex_show)

Original issue reported on code.google.com by Helight.Xu@gmail.com on 10 Sep 2010 at 9:23

GoogleCodeExporter commented 9 years ago

Original comment by Helight.Xu@gmail.com on 23 Nov 2010 at 10:49