rendered paste body#include<stdio.h>
#include<conio.h>
/* THX Peasley & thetest :)*/
int main() {
long int size;
FILE * thetest;
char c;
clrscr();
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");
c=getchar();
printf("\nThe size of the file is:");
if (c=='1') printf("%8ld bytes", size);
else if (c=='2') printf("%4.2ld kilobytes", size/1024);
else if (c=='3') printf("%4.2ld megabytes", size/(1024*1024));
else printf("Wrong number, bastard!");
printf("Exit: Press ENTER!");
getchar();
}
return 0;
}