Read binary file

Frans-Jan Wind's icon

Hi,

I'd like to read binary data from file into max. (Or at least to know if this is possible)

Does any of you know where to start? the file is updated frequently by an other application (as you can see in the code)

I've got a code example in C++

FILE         *fpFloatChannels;
double    dFloatChannelArray[80];

Main()
{

// Somewhere at the beginning of the program, open the FILE pointer: (check that the file path may be different if you installed BioTrace+ in another location.
fpFloatChannels = fopen( “c:pathtodatachan.bin”,”rb” )

// Go into the program loop run()
Application code goes here……which calls the ScanFloatChannels() function 10 to 20 times per second. (for instance by using a windows timer function)

// Clean up, when exiting…
fclose(fpFloatChannels );

// Leave the application…

}

// This function is called by the client software to get and update the channel data. These are updated some 5-10 times per second, on the harddisk. (depending on the speeds of the harddisk)

void ScanFloatChannels()
{
    if ( fpFloatChannels )
    {
        // Read the binary floats into the global array:
fread( &dFloatChannelArray, sizeof(dFloatChannelArray),1,fpFloatChannels );
    }
}

Many thanks for any pointers