1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <stdio.h>
#include <malloc.h>
int GetFileSize (const char *_pszFilename)
{
FILE *pFichier= NULL;
int iFileSize=0;
pFichier = fopen (_pszFilename, "rb");
if (pFichier == NULL)
{
printf ("Erreur d'ouverture de %s en lecture \n", _pszFilename);
return 0;
}
fseek (pFichier, 0, SEEK_END);
iFileSize = ftell (pFichier)- 44;
fseek (pFichier, 0, SEEK_SET);
fclose (pFichier);
return iFileSize;
}
int main (void)
{
//FILE *pFichier= NULL;
char *pszFichier = "ouvre.wav";
int iFileSize=0;
iFileSize= GetFileSize (pszFichier);
printf ("taille de fichier: %s\n", iFileSize);
system("PAUSE");
return 0;
} |