📄 c-iosys5.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> I/O System </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-iosys.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-iosys4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-iosys6.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="84032">3.5 Other Formatted I/O</a></i></h3></font><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84033">3.5.1 Special Cases: <b class="routine"><i class="routine">printf</i></b><b>( )</b>, <b class="routine"><i class="routine">sprintf</i></b><b>( )</b>, and<b class="routine"><i class="routine"> sscanf</i></b><b>( )</b> </a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84037"> </a>The routines <b class="routine"><i class="routine">printf</i></b><b>(</b> <b>)</b>, <b class="routine"><i class="routine">sprintf</i></b><b>(</b> <b>)</b>, and <b class="routine"><i class="routine">sscanf</i></b><b>(</b> <b>)</b> are generally considered to be part of the standard <i class="acronym_lc">stdio</i> package. However, the VxWorks implementation of these routines, while functionally the same, does not use the <i class="acronym_lc">stdio</i> package. Instead, it uses a self-contained, formatted, non-buffered interface to the I/O system in the library <b class="library">fioLib</b>. Note that these routines provide the functionality specified by ANSI;<b class="routine"><i class="routine"> </i></b>however, <b class="routine"><i class="routine">printf</i></b><b>(</b> <b>)</b> is not buffered.</p><dd><p class="Body"><a name="84040"> </a>Because these routines are implemented in this way, the full <i class="acronym_lc">stdio</i> package, which is optional, can be omitted from a VxWorks configuration without sacrificing their availability. Applications requiring <i class="i">printf</i>-style output that is buffered can still accomplish this by calling <b class="routine"><i class="routine">fprintf</i></b><b>(</b> <b>)</b> explicitly to <i class="acronym_lc">stdout</i>.</p><dd><p class="Body"><a name="84041"> </a>While <b class="routine"><i class="routine">sscanf</i></b><b>(</b> <b>)</b> is implemented in <b class="library">fioLib</b> and can be used even if <i class="acronym_lc">stdio</i> is omitted, the same is not true of <b class="routine"><i class="routine">scanf</i></b><b>(</b> <b>)</b>, which is implemented in the usual way in <i class="acronym_lc">stdio</i>.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84043">3.5.2 Additional Routines: <b class="routine"><i class="routine">printErr</i></b><b>( )</b> and <b class="routine"><i class="routine">fdprintf</i></b><b>( )</b></a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84044"> </a>Additional routines in <b class="library">fioLib</b> provide formatted but unbuffered output. The routine <b class="routine"><i class="routine">printErr</i></b><b>(</b> <b>)</b> is analogous to <b class="routine"><i class="routine">printf</i></b><b>(</b> <b>)</b> but outputs formatted strings to the standard error <i class="acronym_lc">fd</i> (2). The routine <b class="routine"><i class="routine">fdprintf</i></b><b>(</b> <b>)</b> outputs formatted strings to a specified <i class="acronym_lc">fd</i>.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84049">3.5.3 Message Logging</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84051"> </a>Another higher-level I/O facility is provided by the library <b class="library">logLib</b>, which allows formatted messages to be logged without having to do I/O in the current task's context, or when there is no task context. The message format and parameters are sent on a message queue to a logging task, which then formats and outputs the message. This is useful when messages must be logged from interrupt level, or when it is desirable not to delay the current task for I/O or use the current task's stack for message formatting (which can take up significant stack space). The message is displayed on the console unless otherwise redirected at system startup using <b class="routine"><i class="routine">logInit</i></b><b>(</b> <b>)</b> or dynamically using <b class="routine"><i class="routine">logFdSet</i></b><b>(</b> <b>)</b>.</p></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-iosys.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-iosys4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-iosys6.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -