Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <errno.h>
- #include <fcntl.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
- int main(int argc, char *argv[]) {
- FILE* f;
- char c;
- if ((f = fopen(argv[1], "w")) == NULL) {
- perror("fopen");
- exit(EXIT_FAILURE);
- }
- fprintf(f, "%s\n", argv[2]);
- scanf("%c", &c);
- fflush(f);
- if (fclose(f) != 0) {
- perror("fclose");
- exit(EXIT_FAILURE);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment