diff options
| author | Thomas Schmucker <ts@its1.de> | 2025-04-13 22:43:46 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2025-04-13 22:43:46 +0200 |
| commit | 7d956c533e9fd7d3bbb9a4a8b7f89f0fe54d4bc3 (patch) | |
| tree | ea1c5bc19dfe6bacad2d377378c460ee5284e74e /contrib/seq-read.c | |
| parent | 85fe3b67a67825dfc5e43959f001b2a7159dc23f (diff) | |
| download | libcsv-7d956c533e9fd7d3bbb9a4a8b7f89f0fe54d4bc3.tar.gz libcsv-7d956c533e9fd7d3bbb9a4a8b7f89f0fe54d4bc3.tar.bz2 libcsv-7d956c533e9fd7d3bbb9a4a8b7f89f0fe54d4bc3.zip | |
first draft
Diffstat (limited to 'contrib/seq-read.c')
| -rw-r--r-- | contrib/seq-read.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/seq-read.c b/contrib/seq-read.c new file mode 100644 index 0000000..90d201f --- /dev/null +++ b/contrib/seq-read.c | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include <stdlib.h> | ||
| 3 | #include <time.h> | ||
| 4 | |||
| 5 | int | ||
| 6 | main(void) | ||
| 7 | { | ||
| 8 | clock_t start = clock(); | ||
| 9 | size_t sum = 0; | ||
| 10 | |||
| 11 | for ( int ch; (ch = getc(stdin)) != EOF; ) { | ||
| 12 | sum += (unsigned char) ch; | ||
| 13 | } | ||
| 14 | |||
| 15 | clock_t end = clock(); | ||
| 16 | |||
| 17 | printf("Result: %zu, Duration: %.3lf sec\n", sum, ((double)(end - start)) / CLOCKS_PER_SEC); | ||
| 18 | |||
| 19 | return EXIT_SUCCESS; | ||
| 20 | } | ||
