Hideaki Tai / msgpack-embedded

Dependents:   hello_message_pack

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fbuffer.h Source File

fbuffer.h

00001 /*
00002  * MessagePack for C FILE* buffer adaptor
00003  *
00004  * Copyright (C) 2013 Vladimir Volodko
00005  *
00006  *    Distributed under the Boost Software License, Version 1.0.
00007  *    (See accompanying file LICENSE_1_0.txt or copy at
00008  *    http://www.boost.org/LICENSE_1_0.txt)
00009  */
00010 #ifndef MSGPACK_FBUFFER_H
00011 #define MSGPACK_FBUFFER_H
00012 
00013 #include <stdio.h>
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018 
00019 
00020 /**
00021  * @defgroup msgpack_fbuffer FILE* buffer
00022  * @ingroup msgpack_buffer
00023  * @{
00024  */
00025 
00026 static inline int msgpack_fbuffer_write(void* data, const char* buf, size_t len)
00027 {
00028     return (1 == fwrite(buf, len, 1, (FILE *)data)) ? 0 : -1;
00029 }
00030 
00031 /** @} */
00032 
00033 
00034 #ifdef __cplusplus
00035 }
00036 #endif
00037 
00038 #endif /* msgpack/fbuffer.h */