diff options
author | Lars Wirzenius <liw@liw.fi> | 2010-10-25 10:37:32 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2010-10-25 10:37:32 +0100 |
commit | ed77916173766327248d84453564f1ae05b05535 (patch) | |
tree | adb0e4c58330deae014897fca913fd51b869833b /dynstr.h | |
parent | 20da8374e9da7009da7fe7cfbf81387f6cc94dc6 (diff) | |
download | dynstr-ed77916173766327248d84453564f1ae05b05535.tar.gz |
Implement dynstr_write.
Changed the function signature since write(2) is so different from
fwrite(3), and there's no point in trying to shoehorn the two into
the same mold.
Diffstat (limited to 'dynstr.h')
-rw-r--r-- | dynstr.h | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -136,12 +136,15 @@ size_t dynstr_last_string(Dynstr *dynstr, size_t offset, Dynstr *pattern); * Comparisons are done byte-by-byte using unsigned values. */ int dynstr_cmp(Dynstr *dynstr1, Dynstr *dynstr2); -/* Write a dynamic string into an open file, either FILE or a Unix file - * handle. Return value is number of bytes written, just like for fwrite(3). +/* Write a dynamic string into an open file (using stdio). Return value is + * number of bytes written, just like for fwrite(3). * If an error occurs, the size is less than the length of the string, * and errno has been set by fwrite(3). */ size_t dynstr_fwrite(FILE *file, Dynstr *dynstr); -size_t dynstr_write(int file, Dynstr *dynstr); + +/* Write a dynamic string into an open Unix file handle. Return value is + * number of bytes written, or -1. */ +ssize_t dynstr_write(int file, Dynstr *dynstr); /* Read a number of bytes from an open file, either FILE or a Unix file * handle. Return value is number of bytes read, just like for fread(3). |