同步操作将从 tboox/tbox 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
TBOX is a glib-like cross-platform C library that is simple to use yet powerful in nature.
The project focuses on making C development easier and provides many modules (.e.g stream, asio, regex, container, algorithm ...), so that any developer can quickly pick it up and enjoy the productivity boost when developing in C language.
It supports the following platforms:
If you want to know more, please refer to:
tb_xxx
prefix for avoiding conflictmemset_u16
, memset_u32
, memset_u64
extension interfacestb_xxx
prefix for avoiding conflictSome projects using tbox:
Please install xmake first: xmake
# build for the host platform
cd ./tbox
xmake
# build for the mingw platform
cd ./tbox
xmake f -p mingw --sdk=/home/mingwsdk
xmake
# build for the iphoneos platform
cd ./tbox
xmake f -p iphoneos
xmake
# build for the android platform
cd ./tbox
xmake f -p android --ndk=xxxxx
xmake
# build for the linux cross-platform
cd ./tbox
xmake f -p linux --sdk=/home/sdk # --toolchains=/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 some time
getchar();
// exit tbox
tb_exit();
return 0;
}
TBOX是一个用c语言实现的跨平台开发库。
针对各个平台,封装了统一的接口,简化了各类开发过程中常用操作,使你在开发过程中,更加关注实际应用的开发,而不是把时间浪费在琐碎的接口兼容性上面,并且充分利用了各个平台独有的一些特性进行优化。
这个项目的目的,是为了使C开发更加的简单高效。
目前支持的平台有:
如果你想了解更多,请参考:
针对http、file、socket、data等流数据,实现统一接口进行读写,并且支持: 阻塞、非阻塞、异步 三种读写模式。 支持中间增加多层filter流进行流过滤,实现边读取,内部边进行解压、编码转换、加密等操作,极大的减少了内存使用。
主要提供以下特性:
stream
:通用非阻塞流,用于一般的单独io处理。async_stream
:利用asio实现的纯异步流,基于回调模式,可同时处理大量并发io。transfer
:传输器,维护两路流的传输,对async_stream
的使用进行更上层的封装,用其可以很方便的实现下载、上传、复制等io传输操作。transfer_pool
:传输池,基于asio,维护大量并发的传输,可以用于实现爬虫、批量下载等等。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 #--toolchains=/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 some time
getchar();
// exit tbox
tb_exit();
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。