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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
--- nrg2iso.c.orig 2004-05-05 22:38:35.056108024 -0400
+++ nrg2iso.c 2004-05-05 22:41:46.129060520 -0400
@@ -78,8 +78,8 @@
FILE *nrgFile, *isoFile;
char buffer[1048576];
int i=0,j=0;
- int size=0,k=0,l;
- int nrgSize=0;
+ off_t size=0,k=0,l, stepsize;
+ off_t nrgSize=0;
float pourcent=0.0;
struct stat buf;
@@ -96,6 +96,8 @@
nrgFile=fopen(argv[1],"r");
fseek (nrgFile, 307200, SEEK_SET);
+ stepsize = nrgSize / 70;
+
isoFile=fopen(argv[2],"w+");
while((i= fread( buffer, 1, 1048576, nrgFile ))>0){
@@ -104,17 +106,13 @@
size+=i;
pourcent = (100.0*size)/nrgSize;
- if(j==10){
- j=0;
- k++;
- printf("\r");
- printf("|");
- for(l=0;l<k;l++)
+ k = size / stepsize;
+ printf("\r");
+ printf("|");
+ for(l=0;l<k;l++)
printf("=");
- printf(">[%d\%]",(int)pourcent);
- fflush(stdout);
- }
- j++;
+ printf(">[%d\%]", (int)pourcent);
+ fflush(stdout);
}
printf("\r");
@@ -126,7 +124,7 @@
fclose(nrgFile);
fclose(isoFile);
- printf("\n%s written : %d bytes\n",argv[2],size);
+ printf("\n%s written : %.2f MB\n",argv[2],(float)size/1024/1024);
}
}
else
|