2012-08-30から1日間の記事一覧

statの謎

#include <stdio.h> #include <stdlib.h> #include <sys/stat.h> int main(int argc, char *argv[]) { struct stat sb; char *file = "/dev/stdin"; if (stat(file, &sb) == -1) { perror("stat"); exit(EXIT_FAILURE); } switch (sb.st_mode & S_IFMT) { case S_IFBLK: printf("block devic</sys/stat.h></stdlib.h></stdio.h>…