This action will force synchronization from tboox/tbox, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
TBOX是一个用c语言实现的跨平台开发库。
针对各个平台,封装了统一的接口,简化了各类开发过程中常用操作,使你在开发过程中,更加关注实际应用的开发,而不是把时间浪费在琐碎的接口兼容性上面,并且充分利用了各个平台独有的一些特性进行优化。
这个项目的目的,是为了使C开发更加的简单高效。
目前支持的平台有:
通过xmake支持各种编译模式:
如果你想了解更多,请参考:
针对http、file、socket、data等流数据,实现统一接口进行读写,并且支持: 阻塞、非阻塞、异步 三种读写模式。 支持中间增加多层filter流进行流过滤,实现边读取,内部边进行解压、编码转换、加密等操作,极大的减少了内存使用。
主要提供以下模块:
stream
:通用非阻塞流,用于一般的单独io处理,同时支持协程以实现异步传输。transfer
:流传输器,维护两路流的传输。static_stream
:针对静态数据buffer优化的静态流,用于轻量快速的数据解析。memset_u16
、memset_u32
等接口,并对其进行高度优化,尤其适合图形渲染程序请先安装: xmake
# 默认直接编译当前主机平台
$ cd ./tbox
$ xmake
# 编译mingw平台
$ cd ./tbox
$ xmake f -p mingw --sdk=/home/mingwsdk
$ xmake
# 编译iphoneos平台
$ cd ./tbox
$ xmake f -p iphoneos
$ xmake
# 编译android平台
$ cd ./tbox
$ xmake f -p android --ndk=xxxxx
$ xmake
# 交叉编译
$ cd ./tbox
$ xmake f -p linux --sdk=/home/sdk #--bin=/home/sdk/bin
$ xmake
#include "tbox/tbox.h"
int main(int argc, char** argv)
{
// init tbox
if (!tb_init(tb_null, tb_null)) return 0;
// trace
tb_trace_i("hello tbox");
// init vector
tb_vector_ref_t vector = tb_vector_init(0, tb_element_cstr(tb_true));
if (vector)
{
// insert item
tb_vector_insert_tail(vector, "hello");
tb_vector_insert_tail(vector, "tbox");
// dump all items
tb_for_all (tb_char_t const*, cstr, vector)
{
// trace
tb_trace_i("%s", cstr);
}
// exit vector
tb_vector_exit(vector);
}
// init stream
tb_stream_ref_t stream = tb_stream_init_from_url("http://www.xxx.com/file.txt");
if (stream)
{
// open stream
if (tb_stream_open(stream))
{
// read line
tb_long_t size = 0;
tb_char_t line[TB_STREAM_BLOCK_MAXN];
while ((size = tb_stream_bread_line(stream, line, sizeof(line))) >= 0)
{
// trace
tb_trace_i("line: %s", line);
}
}
// exit stream
tb_stream_exit(stream);
}
// wait
getchar();
// exit tbox
tb_exit();
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。