#include <u.h>
#include <libc.h>
#include <bio.h>
#define STDIN 0
/* count characters in input; second version */
void
main()
{
Biobuf *bstdin;
bstdin = Bfdopen(STDIN, OREAD);
float nc;
for (nc = 0; Bgetc(bstdin) >= 0; ++nc)
;
print("%.0f\n", nc);
exits(0);
}
$ 9c chars.c; 9l chars.o -o chars
$ ./chars
How many characters are here?
30