openとread
#include <stdio.h> #include <fcntl.h> int main(){ int fp; char c[20]; fp = open("./test.txt", O_RDONLY); read(fp, c, 20); printf("%s", c); return 0; } /* test.txtは以下 0123456789 0123456789 ちなみに2行目の8まで表示される。*/
#include <stdio.h> #include <fcntl.h> int main(){ int fp; char c[20]; fp = open("./test.txt", O_RDONLY); read(fp, c, 20); printf("%s", c); return 0; } /* test.txtは以下 0123456789 0123456789 ちなみに2行目の8まで表示される。*/