void copy int FILE fopen save txt for getmaxx for getmaxy -50 fprintf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
void copy()
{
int x,y;
FILE*f;
f = fopen("save.txt","w+");
for (x=0;x<getmaxx();x++)
for (y=0;y<getmaxy()-50;y++)
{
fprintf(f,"%d",getpixel(x,y));
fprintf(f,"\n");
}
}
void paste()
{
int x,y,color;
FILE *f;
f=fopen("save.txt","r");
for (x=0;x<getmaxx();x++)
for (y=0;y<getmaxy()-50;y++)
{
fscanf(f,"%d",&color);
putpixel(x,y,color);
}
getch();
cleardevice();
}