351 |
351 |
352 ## Utilities |
352 ## Utilities |
353 |
353 |
354 *Header file:* [utils.h](api/utils_8h.html) |
354 *Header file:* [utils.h](api/utils_8h.html) |
355 |
355 |
356 UCX provides some utilities for routine tasks. Most of them are simple macros, like e.g. the `cx_for_n()` macro, |
356 UCX provides some utilities for routine tasks. |
357 creating a `for` loop counting from zero to (n-1) which is extremely useful to traverse the indices of |
357 |
358 an array. |
358 The most useful utilities are the *stream copy* functions, which provide a simple way to copy all - or a |
359 |
|
360 But the most useful utilities are the *stream copy* functions, which provide a simple way to copy all - or a |
|
361 bounded amount of - data from one stream to another. Since the read/write functions of a UCX buffer are |
359 bounded amount of - data from one stream to another. Since the read/write functions of a UCX buffer are |
362 fully compatible with stream read/write functions, you can easily transfer data from file or network streams to |
360 fully compatible with stream read/write functions, you can easily transfer data from file or network streams to |
363 a UCX buffer or vice-versa. |
361 a UCX buffer or vice-versa. |
364 |
362 |
365 The following example shows, how easy it is to read the contents of a file into a buffer: |
363 The following example shows, how easy it is to read the contents of a file into a buffer: |