Fri, 24 Jan 2025 21:12:09 +0100
assign proper names to the documentation topics
relates to #451
# Stream Operations UCX provides some utilities for routine tasks. The most useful utilities are the *stream copy* functions, which provide a simple way to copy all - or a bounded amount of - data from one stream to another. Since the read/write functions of a UCX buffer are fully compatible with stream read/write functions, you can easily transfer data from file or network streams to a UCX buffer or vice-versa. The following example shows, how easy it is to read the contents of a file into a buffer: ```c FILE *inputfile = fopen(infilename, "r"); if (inputfile) { CxBuffer fbuf; cxBufferInit(&fbuf, NULL, 4096, NULL, CX_BUFFER_AUTO_EXTEND); cx_stream_copy(inputfile, &fbuf, (cx_read_func) fread, cxBufferWriteFunc); fclose(inputfile); // ... do something meaningful with the contents ... cxBufferDestroy(&fbuf); } else { perror("Error opening input file"); if (fout != stdout) { fclose(fout); } } ``` ## Undocumented Symbols (TODO) ### cx_stream_bncopy ### cx_stream_ncopy