Function From C to Delphi

Posted by XBasic3000 on Stack Overflow See other posts from Stack Overflow or by XBasic3000
Published on 2010-06-02T05:11:34Z Indexed on 2010/06/02 5:13 UTC
Read the original article Hit count: 244

Filed under:
|
|
|
|

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;
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about c++