#include // open, close, O_RDONLY #include // printf, scanf, perror #include // read // print characters from column m to n (1 indexed) for each row int main(int argc, char* argv[]) { int f = open(argv[1], O_RDONLY); if (f < 0) { perror("open"); return 1; } int m, n; scanf("%d %d", &m, &n); int col = 1; char buf; while (read(f, &buf, 1)) { if (buf == '\n') { col = 1; printf("\n"); continue; } if (m <= col && col <= n) { printf("%c", buf); } col++; } close(f); }