Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <time.h>
- #include <signal.h>
- int main(int argc, char *argv[]) {
- FILE *fp2;
- fp2 = fopen(argv[1], "w");
- char input[10000];
- char temp[10000];
- char *pch;
- time_t current;
- if (argv[1]==NULL) {
- printf("No file name specified");
- }
- else {
- while (fgets(input, sizeof(input), stdin)) {
- strcpy(temp, input);
- time(¤t);
- strcpy(input, ctime(¤t));
- pch=strchr(input, '\n');
- strcpy(pch, " ");
- strcat(input, temp);
- fprintf(fp2, "%s", input);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement