

#include <stdio.h>                     // Need this for fopen(..) fwrite(..) etc

// We use this simple function to write data to our file.
void fileout(char *str)
{
      FILE *fp;
      fp=fopen("output.txt", "a+");   // a+ -> if file doesn't exist create it, else
      fprintf(fp, "%s", str);         //       append to the end of the file
      fclose(fp); 
}// End fileout(..)

long FileSize( char * szFileName )
{
	FILE *file = fopen(szFileName, "rb"); // Open the file
	fseek(file, 0, SEEK_END);             // Seek to the end
	long file_size = ftell(file);         // Get the current position
	fclose(file);
	
	return file_size;                     // We have the file size, so return it
}// End FileSize(..)

//Program Entry Point
void main(int argc, char* argv[])
{
	char szFileName[] = "default.xbe";    // Our input xbe
	char buf[500];                        // Large temp char buffer

	long iFileSize = FileSize(szFileName);

	sprintf(buf, "xbe filesize: %d bytes", iFileSize);
	fileout(buf);

}// End main(..)






