Add cfw_stream_write_string().

This commit is contained in:
Jonathan Schleifer 2012-09-30 00:41:59 +02:00
parent c18e55e2ff
commit f9d9a2a9a8
2 changed files with 9 additions and 0 deletions

View file

@ -24,6 +24,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <string.h>
#include "stream.h" #include "stream.h"
static bool static bool
@ -68,6 +70,12 @@ cfw_stream_write(void *ptr, const void *buf, size_t len)
return stream->ops->write(stream, buf, len); return stream->ops->write(stream, buf, len);
} }
bool
cfw_stream_write_string(void *ptr, const char *str)
{
return cfw_stream_write(ptr, str, strlen(str));
}
bool bool
cfw_stream_eof(void *ptr) cfw_stream_eof(void *ptr)
{ {

View file

@ -47,6 +47,7 @@ typedef struct CFWStream {
extern CFWClass *cfw_stream; extern CFWClass *cfw_stream;
extern ssize_t cfw_stream_read(void*, void*, size_t); extern ssize_t cfw_stream_read(void*, void*, size_t);
extern bool cfw_stream_write(void*, const void*, size_t); extern bool cfw_stream_write(void*, const void*, size_t);
extern bool cfw_stream_write_string(void*, const char*);
extern bool cfw_stream_eof(void*); extern bool cfw_stream_eof(void*);
extern void cfw_stream_close(void*); extern void cfw_stream_close(void*);
#endif #endif