git.samba.org
/
tridge
/
junkcode.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
added sparse test
[tridge/junkcode.git]
/
tread.c
1
#include <unistd.h>
2
#include <stdio.h>
3
#include <fcntl.h>
4
5
main(int argc, char *argv[])
6
{
7
int fd, n, total=0;
8
char buffer[64*1024];
9
10
fd = open(argv[1], O_RDONLY);
11
12
if (fd == -1) {
13
perror(argv[1]);
14
exit(1);
15
}
16
17
/* lseek(fd, 300*1024*1024, SEEK_SET); */
18
19
while (1) {
20
if ((n = read(fd, buffer, sizeof(buffer))) != sizeof(buffer)) {
21
printf("\neof at %d\n", total);
22
break;
23
}
24
total += n;
25
printf("read %9d bytes\r", total);
26
fflush(stdout);
27
}
28
printf("\n");
29
return 0;
30
}