[問題] 設定_IONBF失敗?
Hi,
我用 RS232 接到板子上印出一些東西, 因為 serial port tty 是 line buffered, 所以
我用 setvbuf+_IONBF 設成 no buffer, 所以若是我的程式裡面寫
printf("hello \n");
printf("world");
while(1) {
/* Wait for some event and exit */
}
"world" 是可以印出來的, 但是若寫成像
char *str = "beautiful";
printf("hello \n");
printf("world is %s", str);
while(1) {
/* Wait for some event and exit */
}
則 "beautiful" 還是要等到 while 裡面的事情做完才會印
可以給我提示怎麼解決嗎?
Thanks.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.209.21
→
03/26 03:38, , 1F
03/26 03:38, 1F
→
03/26 03:41, , 2F
03/26 03:41, 2F
→
03/26 03:42, , 3F
03/26 03:42, 3F