C-从二进制文件读取字符串不起作用

我有一个员工结构:

typedef struct employee
{
    int name_length;
    char* name;
    float salary;
} Employee;

现在我想创建一个雇员数组,并从二进制文件中为每个雇员获取名称和薪水。 (二进制文件方案的构建方式为:6michel7544.564 ...(名称长度,名称本身,工资)等等,雇员人数未知)

我建立了这个函数来建立数组:

Employee** makeEmpArray(char* fname1, int* size)
{
    FILE* empFile;
    int k = 0;
    Employee** arr; //array of employees
    arr = (Employee**)malloc(sizeof(Employee*));
    assert(arr != NULL);
    empFile = fopen(fname1, "rb");
    if (ferror(empFile))
    {
        printf("Error, cant open file");
        exit(2);
    }
    while (!feof(empFile))
    {
        arr[k] = (Employee*)malloc(sizeof(Employee));
        assert(arr[k]);
        fread(&(arr[k]->name_length), sizeof(int), 1, empFile); // get length of name 
        arr[k]->name = (char*)malloc(arr[k]->name_length * sizeof(char)); //allocate memory for name in namelength size
        assert(arr[k]->name!=NULL);
        fread(arr[k]->name, sizeof(char), arr[k]->name_length, empFile); //read letter letter (namelen times)
        fread(&arr[k]->salary, sizeof(float), 1, empFile); //reads floeat salary
        k++;
        arr = realloc(arr, (k + 1) * sizeof(Employee*)); //realloc for next employee
        assert(arr != NULL);
    }
    fclose(empFile);
    *size = k;
    return arr;
}

除了名字的字符串以外,一切都进行得很好!! 我完美地获得了name_length,我完美地获得了薪水,由于某种原因,这一行是有问题的:

fread(arr[k]->name, sizeof(char), arr[k]->name_length, empFile);

the name does not read from the file. No error is prompt, and when I watch arr[k]->name when debugging I see <invalid characters in string.>

希望您能帮助我确定问题所在! 谢谢!