Version 8.6 Buffering printf characters

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Version 8.6 Buffering printf characters

4,342件の閲覧回数
TomS
Contributor I
When using the printf function in Code Warrior 8.6 for a Power PC to output strings to a Hyper Terminal, I am finding the characters are not sent to the Hyper Terminal until 256 characters are in the output buffer or a '\n' is at the end of the string.
Is there a way to disable this buffering?  I figure it a compile condition I need to set.
 
Thanks
ラベル(1)
タグ(1)
0 件の賞賛
返信
3 返答(返信)

2,023件の閲覧回数
TomS
Contributor I
Thanks Teo, that worked.
 
Now I'm having a problem with gets(). 
The carriage return isn't being read back fully and and the next time I call gets(), it thinks a the carriage return is there, and doesn't wait for key board input?
 
Do you know what can cause this?  This all worked with version 8.1
Thanks
0 件の賞賛
返信

2,023件の閲覧回数
Teo
NXP Employee
NXP Employee
You have to disable buffering for stdin also. If you choosed to recompile MSL this should have been done alreadey with the same macro (_MSL_BUFFERED_CONSOLE), i.e. by recompiling MSL you change buffering for all console files (stdin, stdout, stderr).


In case that you've changed buffering at runtime by calling "setvbuf", note that this is recomended to be done only once at the beggining of "main" before any console IO activities.

Regards,
Teo
0 件の賞賛
返信

2,023件の閲覧回数
Teo
NXP Employee
NXP Employee
You need either to recompile MSL library to not use console IO buffering, or you can change this at runtime with setvbuf. e.g. "setvbuf(stdout, NULL, _IONBF, 0);"

If you decide to recompile MSL, you need to change _MSL_BUFFERED_CONSOLE define to 0 in ansi_prefix.PPCEABI.bare.h.

Regards,
Teo
0 件の賞賛
返信