| 54 |
54 |
| 55 ## Example |
55 ## Example |
| 56 |
56 |
| 57 The following example shows how to read the contents of a file into a buffer: |
57 The following example shows how to read the contents of a file into a buffer: |
| 58 ```c |
58 ```c |
| |
59 #include <cx/buffer.h> |
| |
60 #include <cx/utils.h> |
| |
61 #include <stdio.h> |
| |
62 |
| |
63 // ... |
| |
64 |
| 59 FILE *inputfile = fopen(infilename, "r"); |
65 FILE *inputfile = fopen(infilename, "r"); |
| 60 if (inputfile) { |
66 if (inputfile) { |
| 61 CxBuffer fbuf; |
67 CxBuffer fbuf; |
| 62 cxBufferInit(&fbuf, NULL, NULL, 4096, CX_BUFFER_AUTO_EXTEND); |
68 cxBufferInit(&fbuf, NULL, NULL, 4096, CX_BUFFER_AUTO_EXTEND); |
| 63 cx_stream_copy(inputfile, &fbuf, |
69 cx_stream_copy(inputfile, &fbuf, |