Hi,
  I am using Inline C and have a problem using standard C library,
especially fopen and fscanf. The DLL compiled fine. When I run a perl
script to call the DLL, the Perl crashed.

Below is my C routine:

int test_readfile(char *filename, SV* output) {
        char str[80];
        float f;
        FILE * pFile;

        pFile = fopen(filename, "w+");
        fprintf (pFile, "%f %s", 3.1416, "PI");
        rewind (pFile);
        fscanf (pFile, "%f", &f);
        fscanf (pFile, "%s", str);
        fclose (pFile);
        printf("I have read: %f and %s \n",f,str);
        sv_setpvn(output, "This is a test from C routine!", 30);
        return 0;
}

I am using Windows XP SP2, Visual Studio .NET 2003. The same code
works fine in Linux. Appreciate very much to hear any suggestion...

Regards,
Sin Lam

Reply via email to