Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FILE *tmp_copy = tmpfile();
- file = fopen ( argv[2], "rw" );
- if ((file != NULL )) {
- char line [ 128 ]; /* or other suitable maximum line size */
- while( ( fgets ( line, sizeof line, file ) != NULL )) {
- fputs(line, tmp_copy);
- }
- fclose ( file );
- rewind(tmp);
- char *p;
- /* Reopen file now with write permissions */
- fopen(argv[2], "w");
- while (( p = fgets(line, 1024, tmp))!=NULL) {
- //line[strlen(line)-1] = '