Skip to content

Commit 683ba37

Browse files
committed
update readme
1 parent cd87e92 commit 683ba37

File tree

2 files changed

+6
-84
lines changed

2 files changed

+6
-84
lines changed

README.md

+3-42
Original file line numberDiff line numberDiff line change
@@ -239,58 +239,19 @@ $ make
239239
```c
240240
#include "tbox/tbox.h"
241241

242-
int main(int argc, char** argv)
243-
{
244-
// init tbox
242+
int main(int argc, char** argv) {
245243
if (!tb_init(tb_null, tb_null)) return 0;
246244

247-
// trace
248-
tb_trace_i("hello tbox");
249-
250-
// init vector
251245
tb_vector_ref_t vector = tb_vector_init(0, tb_element_str(tb_true));
252-
if (vector)
253-
{
254-
// insert item
246+
if (vector) {
255247
tb_vector_insert_tail(vector, "hello");
256248
tb_vector_insert_tail(vector, "tbox");
257249

258-
// dump all items
259-
tb_for_all (tb_char_t const*, cstr, vector)
260-
{
261-
// trace
250+
tb_for_all (tb_char_t const*, cstr, vector) {
262251
tb_trace_i("%s", cstr);
263252
}
264-
265-
// exit vector
266253
tb_vector_exit(vector);
267254
}
268-
269-
// init stream
270-
tb_stream_ref_t stream = tb_stream_init_from_url("http://www.xxx.com/file.txt");
271-
if (stream)
272-
{
273-
// open stream
274-
if (tb_stream_open(stream))
275-
{
276-
// read line
277-
tb_long_t size = 0;
278-
tb_char_t line[TB_STREAM_BLOCK_MAXN];
279-
while ((size = tb_stream_bread_line(stream, line, sizeof(line))) >= 0)
280-
{
281-
// trace
282-
tb_trace_i("line: %s", line);
283-
}
284-
}
285-
286-
// exit stream
287-
tb_stream_exit(stream);
288-
}
289-
290-
// wait
291-
tb_getchar();
292-
293-
// exit tbox
294255
tb_exit();
295256
return 0;
296257
}

README_zh.md

+3-42
Original file line numberDiff line numberDiff line change
@@ -246,58 +246,19 @@ $ make
246246
```c
247247
#include "tbox/tbox.h"
248248

249-
int main(int argc, char** argv)
250-
{
251-
// init tbox
249+
int main(int argc, char** argv) {
252250
if (!tb_init(tb_null, tb_null)) return 0;
253251

254-
// trace
255-
tb_trace_i("hello tbox");
256-
257-
// init vector
258252
tb_vector_ref_t vector = tb_vector_init(0, tb_element_str(tb_true));
259-
if (vector)
260-
{
261-
// insert item
253+
if (vector) {
262254
tb_vector_insert_tail(vector, "hello");
263255
tb_vector_insert_tail(vector, "tbox");
264256

265-
// dump all items
266-
tb_for_all (tb_char_t const*, cstr, vector)
267-
{
268-
// trace
257+
tb_for_all (tb_char_t const*, cstr, vector) {
269258
tb_trace_i("%s", cstr);
270259
}
271-
272-
// exit vector
273260
tb_vector_exit(vector);
274261
}
275-
276-
// init stream
277-
tb_stream_ref_t stream = tb_stream_init_from_url("http://www.xxx.com/file.txt");
278-
if (stream)
279-
{
280-
// open stream
281-
if (tb_stream_open(stream))
282-
{
283-
// read line
284-
tb_long_t size = 0;
285-
tb_char_t line[TB_STREAM_BLOCK_MAXN];
286-
while ((size = tb_stream_bread_line(stream, line, sizeof(line))) >= 0)
287-
{
288-
// trace
289-
tb_trace_i("line: %s", line);
290-
}
291-
}
292-
293-
// exit stream
294-
tb_stream_exit(stream);
295-
}
296-
297-
// wait
298-
tb_getchar();
299-
300-
// exit tbox
301262
tb_exit();
302263
return 0;
303264
}

0 commit comments

Comments
 (0)