/*
Low Level I/O - Read and Write
Chapter 8 - The C Programming Language - K&R
Header file in the original code is "syscalls.h"
Also BUFSIZ is supposed to be defined in the same header file
*/
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#define BUFSIZ 1
int main() /* copy input to output */
{
char buf[BUFSIZ];
int n;
while ((n = read(0, buf, BUFSIZ)) > 0)
write(1, buf, n);
return 0;
}
入力として「∂∑∑®†¥¥¥˚π∆˜˜∫∫√ç tu 886661~EOF」を入力すると、同じものがコピーされます。同時に格納される非 ASCII 文字の数は?
BUFSIZ は、転送されるバイト数です。入力から出力に何かをコピーできる場合、BUFSIZ はどのようにバイト転送を制限しますか?
char buf[BUFSIZ] はどのように非 ASCII 文字を格納していますか?