Fri, 24 Jan 2025 21:12:09 +0100
assign proper names to the documentation topics
relates to #451
1143
0559812df10c
assign proper names to the documentation topics
Mike Becker <universe@uap-core.de>
parents:
1142
diff
changeset
|
1 | # Stream Operations |
1141 | 2 | |
3 | UCX provides some utilities for routine tasks. | |
4 | ||
5 | The most useful utilities are the *stream copy* functions, which provide a simple way to copy all - or a | |
6 | bounded amount of - data from one stream to another. Since the read/write functions of a UCX buffer are | |
7 | fully compatible with stream read/write functions, you can easily transfer data from file or network streams to | |
8 | a UCX buffer or vice-versa. | |
9 | ||
10 | The following example shows, how easy it is to read the contents of a file into a buffer: | |
11 | ```c | |
12 | FILE *inputfile = fopen(infilename, "r"); | |
13 | if (inputfile) { | |
14 | CxBuffer fbuf; | |
15 | cxBufferInit(&fbuf, NULL, 4096, NULL, CX_BUFFER_AUTO_EXTEND); | |
16 | cx_stream_copy(inputfile, &fbuf, | |
17 | (cx_read_func) fread, | |
18 | cxBufferWriteFunc); | |
19 | fclose(inputfile); | |
20 | ||
21 | // ... do something meaningful with the contents ... | |
22 | ||
23 | cxBufferDestroy(&fbuf); | |
24 | } else { | |
25 | perror("Error opening input file"); | |
26 | if (fout != stdout) { | |
27 | fclose(fout); | |
28 | } | |
29 | } | |
30 | ``` | |
1142
9437530176bc
add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents:
1141
diff
changeset
|
31 | |
9437530176bc
add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents:
1141
diff
changeset
|
32 | ## Undocumented Symbols (TODO) |
9437530176bc
add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents:
1141
diff
changeset
|
33 | ### cx_stream_bncopy |
9437530176bc
add symbols that need documentation as TODOs
Mike Becker <universe@uap-core.de>
parents:
1141
diff
changeset
|
34 | ### cx_stream_ncopy |