swh:1:snp:9afa324ac020f1c169cae2c8f220a29e1ff11375
Raw File
Tip revision: 632cf0cb0eb192c5364aba31b413b1b58edb8835 authored by David Shorten on 02 November 2021, 11:16:13 UTC
end of results update
Tip revision: 632cf0c
c_reader.cpp
//#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