Fread sem êxito () de int armazenado em arquivo binário, falha de segmentação [fechada]

Parece haver da ordem de 10 perguntas e (na maioria das vezes) respostas bem-sucedidas, solucionando falhas de segmentação causadas por fread () mal usados em C. Dito isto, estou tendo esse problema, mas não encontrei uma solução.

Eu tenho um arquivo binário contendo umint (chame-onbins) e uma matriz defloats (de tamanhonbins) Quando tento ler este arquivo, ele é aberto e aponta com êxito para o identificador de arquivo, mas gera um erro de falha de segmentação ao ler o arquivonbins int. Aqui está um exemplo mínimo:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BPATH "/path/to/file"

int main(int agrc, char **argv)
{
    FILE *fd;
    int num;
    char fname[500]={};

    int nbins;
    float *coords;

    num = 5;
    sprintf(fname,"%s/file%d.dat", BPATH, num);

    if(!(fd=fopen(fname,"rb")))
    {
        printf("Can't open file: %s\n\n",fname);
        exit(0);
    }    

    printf("Reading input file:\n");
    printf("%p: %s\n", fd, fname);       // prints successfully

    fread(&nbins, sizeof(int), 1, fd);   
    printf("nbins = %d", nbins);         // seg faults before this print

    /* EDIT: the above print isn't properly flushed without an \n    
     * The seg fault was not caused by the fread(), but the lack of  
     * the above print lead to the confusion                         */

    coords = malloc(nbins * sizeof(float));
    fread(coords, sizeof(float), nbins, fd);

    fclose(fd);
    free(coords);

    return(0);
}

O arquivo foi criado com a seguinte formatação:

int nbins[1];
nbins[0] = 5;                          // this 5 is just an example...
fwrite(nbins, sizeof(int), 1, file_ptr);
fwrite(coords, sizeof(float), nbins[0], file_ptr);

Eu também tentei usar:

int *nbins = malloc(sizeof(int));
fread(nbins, sizeof(int), 1, fd);

mas isso não resolveu o problema. O arquivo existe e é legível; Eu posso lê-lo muito bem usando Python, com NumPy'sfromfile(). Estou perdendo algo óbvio? Obrigado!