All pastes #757455 Raw Edit

size

public cpp v1 · immutable
·published 2007-11-01 11:23 UTC
rendered paste body
#include<stdio.h>#include<conio.h>int main(char readfile[], char s) { double size; FILE * fp; char c; clrscr(); printf("Please type the name of the file which size you're interested in:"); scanf("%s", readfile); printf ("\n%s", readfile); fp = fopen(readfile, "rb"); if (fp==NULL) perror("Error with opening the file!"); else {  fseek (fp, 0, SEEK_END);  size=ftell(fp);  fclose(thetest);  /* That was the old one */  printf("In which format do you want to see the size of the file?"	 "\n1 - Byte"	 "\n2 - KiloByte"	 "\n3 - MegaByte\n");  c=getchar();  printf("\nThe size of the file is:");  if (c=='1') printf("%.2e bytes", size);  else if (c=='2') printf("%.2e kilobytes", size/1024);  else if (c=='3') printf("%.2e megabytes", size/(1024*1024));  else printf("Wrong number, bastard!");  printf("\nExit: Press ENTER!");  getchar();   }return 0;}