Skip to main content
Participant
March 15, 2011
Question

How to get size of a Image file

  • March 15, 2011
  • 2 replies
  • 1160 views

Hi

Through my plugin I want to transfer a file from my local system to asset server.

But I don't find a way to get the size of bytes to be transferred.

ai::filepath suite doesn't provide a facility to get the size of a file.

Please guide.

Thanks

Ramanath

This topic has been closed for replies.

2 replies

minimum99
Known Participant
March 26, 2011

for Windows:

          FILE *pFile;

        ferr = fopen(&pFile, filename.c_str(),"r");

        // obtain file size:
        fseek (pFile , 0 , SEEK_END);
        lSize = ftell (pFile);
        rewind (pFile);

        // allocate memory to contain the whole file:
        buffer = (char*) malloc (sizeof(char)*lSize);

A. Patterson
Inspiring
March 15, 2011

I don't see anything anywhere in the SDK to do this. I'm afraid you're probably going to have to use your OS API or a 3rd party library for this.