Function From C to Delphi
- by XBasic3000
I created a function similar below in delphi code. but it wont work. What is the proper way to convert this?
char* ReadSpeechFile(char* pFileName, int *nFileSize)
{
char *szBuf, *pLinearPCM;
int nSize;
FILE* fp;
//read wave data
fp = fopen(pFileName, "rb");
if(fp == NULL)
return NULL;
fseek(fp, 0, SEEK_END);
nSize = ftell(fp);
//linear
szBuf = (char *)calloc(nSize, sizeof(char));
fseek(fp, 0, SEEK_SET);
fread(szBuf, sizeof(char), nSize, fp);
fclose(fp);
*nFileSize = nSize;
return szBuf;
}