summaryrefslogtreecommitdiff
path: root/public/fd_printf.html
diff options
context:
space:
mode:
Diffstat (limited to 'public/fd_printf.html')
-rw-r--r--public/fd_printf.html18
1 files changed, 13 insertions, 5 deletions
diff --git a/public/fd_printf.html b/public/fd_printf.html
index ff35631..79266ca 100644
--- a/public/fd_printf.html
+++ b/public/fd_printf.html
@@ -9,11 +9,15 @@
<body>
<header><a href="/">Luke Shumaker</a> » <a href=/blog>blog</a> » fd_printf</header>
<article>
-<h1 id="dprintf-print-formatted-text-directly-to-a-file-descriptor"><code>dprintf</code>: print formatted text directly to a file descriptor</h1>
-<p>This already existed as <code>dprintf(3)</code>. I now feel stupid for having Implemented <code>fd_printf</code>.</p>
+<h1
+id="dprintf-print-formatted-text-directly-to-a-file-descriptor"><code>dprintf</code>:
+print formatted text directly to a file descriptor</h1>
+<p>This already existed as <code>dprintf(3)</code>. I now feel stupid
+for having Implemented <code>fd_printf</code>.</p>
<p>The original post is as follows:</p>
<hr />
-<p>I wrote this while debugging some code, and thought it might be useful to others:</p>
+<p>I wrote this while debugging some code, and thought it might be
+useful to others:</p>
<pre><code>#define _GNU_SOURCE /* vasprintf() */
#include &lt;stdarg.h&gt; /* va_start()/va_end() */
#include &lt;stdio.h&gt; /* vasprintf() */
@@ -36,8 +40,12 @@ fd_printf(int fd, const char *format, ...)
free(str);
return len;
}</code></pre>
-<p>It is a version of <code>printf</code> that prints to a file descriptor—where <code>fprintf</code> prints to a <code>FILE*</code> data structure.</p>
-<p>The appeal of this is that <code>FILE*</code> I/O is buffered—which means mixing it with raw file descriptor I/O is going to produce weird results.</p>
+<p>It is a version of <code>printf</code> that prints to a file
+descriptor—where <code>fprintf</code> prints to a <code>FILE*</code>
+data structure.</p>
+<p>The appeal of this is that <code>FILE*</code> I/O is buffered—which
+means mixing it with raw file descriptor I/O is going to produce weird
+results.</p>
</article>
<footer>