How could I make a c program that loads a file, display the time it took to load the file and display the size of the program in bytes?
How could I make a c program that loads a file, display the time it took to load the file and display the size of the program in bytes?
put time fn before and after of your load file fn and calculate difference between them.so you get tiem to taken to load the file and use standard file structur to calculate the size of programm in gcc.
i thought there is a function that can get time or something...gethrtime() ?????
I managed to find the time, but I cant get my program to display "Your program size is ______ bytes". Any ideas?
Thank in advance
What exactly do you mean? Do you want the size, in bytes, of the program itself, or of a particular file that it is loading?
If you're reading a file using the standard C functions (fopen, fclose, fread, fwrite, fgets, etc.) then, when you're done, call ftell() (which tells you where you are in the file). If you're at the end (which you can be if you call fseek()), then it'll be the file's size. (with a few caveats for text files, where it is less helpful...)
Alternatively, you can query the filesystem by calling stat().
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
I'm trying to find out what is the total memory allocated in bytes for the words being inserted.