home *** CD-ROM | disk | FTP | other *** search
- /*
- ** backup an ascii file
- ************************************************************* */
-
-
- #include "stdio.h"
-
- main()
- {
- char in_name[11], out_name[15];
- FILE *read_file, *out_file, *fopen ();
- int c;
-
- printf("enter name of file to be backed up : ");
- scanf ("%.10s", &in_name);
- printf("%s\n",in_name);
- printf("enter name of backup file : ");
- scanf ("%.14s", &out_name);
-
- read_file = fopen (in_name, "r");
-
- if ( read_file == NULL )
- printf("couldn't open %s for reading.\n",in_name);
- else
- {
- out_file = fopen (out_name, "w");
- if (out_file == NULL )
- Printf("couldn't open %s for writing.\n",out_name);
- else
- {
- while ( (c = getc(read_file)) != EOF )
- putc (c, out_file);
-
- printf("file has been BACKED UP!\n");
-
- }
- }
- fclose(out_file);
- fclose(read_file);
-
- }
-