2013년 9월 26일 목요일

android에서 커널 버전 정보 읽는 법.

how to get kernel version info with c code like a uname command.

  FILE *f = fopen("/proc/version", "r");
        while (!feof (f)) {
                printf("%c", fgetc(f));
        }
        fclose (f);

간단한 코드로 만듦.


얘는 write 안쓰다 보니 다 까먹어서 남겨둠.

    FILE *f = fopen("/proc/cpuinfo", "r");
        int d = open("./ddd.txt", O_WRONLY | O_CREAT | O_EXCL, 0644);
        char a;
        while (!feof (f)) {
                a=fgetc(f);
                write(d, &a, sizeof(&a));
        }
        fclose (f);
        close (d);

댓글 없음:

댓글 쓰기

국정원의 댓글 공작을 지탄합니다.

UPBIT is a South Korean company, and people died of suicide cause of coin investment.

 UPBIT is a South Korean company, and people died of suicide cause of coin. The company helps the people who control the market price manipu...