All pastes #756634 Raw Edit

size

public c v1 · immutable
#756634 ·published 2007-10-31 17:04 UTC
rendered paste body
#include<stdio.h>#include<conio.h>int main() { float size; FILE * thetest; char c, readfile[20]; clrscr();/* printf("Please type the name of the file which size you're interested in."); scanf("%s", readfile);*/ thetest = fopen("news.jpg", "rb"); if (thetest==NULL) perror("Error!"); else {  fseek (thetest, 0, SEEK_END);  size=ftell(thetest);  fclose(thetest);  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("%.2ft bytes", size);  else if (c=='2') printf("%.2ft kilobytes", size/1024);  else if (c=='3') printf("%.2ft megabytes", size/(1024*1024));  else printf("Wrong number, bastard!");  printf("Exit: Press ENTER!");  getchar();   }return 0;}