#include #include #include #include int main(int argc, char** argv) { FILE* f; StringView pathname; ArgumentParser parser; parser.add_positional_argument(pathname, "file"_sv, true); parser.parse(argc, argv); f = fopen(pathname.chars(), "w"); if (!f) { perror(pathname.chars()); return 1; } char buffer[4096]; while (1) { char* rc = fgets(buffer, sizeof(buffer), stdin); if (rc == 0) break; fputs(buffer, f); } fclose(f); return 0; }