Raw File
//#include <iostream>
//#include <fstream>
#include <stdio.h>
//using namespace std;

typedef struct {	
    unsigned long long time;
    short channel;
    short height;	
    short width;	
    short context[74];	
    short threshold;	
} Spikeinfo;

int main() {

    int NUM_SPIKES = 10;

    FILE *pFile;
    pFile = fopen ("spikes1.txt","w");
    
    //ofstream myfile;
    //myfile.open ("spikes1.txt");

    Spikeinfo buffer[NUM_SPIKES];
    int n;
    FILE *fh;

    fh = fopen("1-3-5.5.spike","rb+");
    n = fread(buffer, sizeof(Spikeinfo), NUM_SPIKES, fh);

    for(int j = 0; j < NUM_SPIKES; j++) {
	printf("%llu ", buffer[j].time);
	printf("%hd \n", buffer[j].channel);
	//fprintf(pFile, "%hu ", buffer[j].channel);
	//myfile << buffer[j].channel << " " << buffer[j].time << endl;
    }
    fclose(pFile);

    //myfile.close();
    return 0;
}
back to top