]> git.armaanb.net Git - stagit.git/blob - src/cp.h
Copy css in stagit-index
[stagit.git] / src / cp.h
1 #include <stdlib.h>
2 #include <stdio.h>
3
4 int cp(char fileSource[], char fileDestination[])
5 {
6     int c;
7     FILE *stream_R, *stream_W; 
8
9     stream_R = fopen(fileSource, "r");
10     if (stream_R == NULL)
11         return -1;
12     stream_W = fopen(fileDestination, "w");   //create and write to file
13     if (stream_W == NULL)
14      {
15         fclose(stream_R);
16         return -2;
17      }    
18     while ((c = fgetc(stream_R)) != EOF)
19         fputc(c, stream_W);
20     fclose(stream_R);
21     fclose(stream_W);
22
23     return 0;
24 }
25