害怕没有加载我的二进制文件中的内容?

fread not loading in whats in my binary file?

基本上,我已经将文本写入文件,听说在程序开始时将内容读回我的数组是类似的步骤,但没有读回任何内容。这是我的代码

void backUp(PAYROLL employee[], long int *pCounter)
{
    FILE *record;
        errno_t result = fopen_s(&record, "c:\record.bin", "a+b");
    if (record != 0){
        fwrite(employee, sizeof(PAYROLL), 1 , record);
        fclose(record);
    }
}

void upload(PAYROLL employee[], long int *pCounter)
{

    FILE *record;
    errno_t result = fopen_s(&record, "c:\record.bin", "r+b");
    if (record != 0)
    {
        fread(employee, sizeof(PAYROLL), 1, record);
        fclose(record);
    }
}

要在系统驱动器的根目录中创建和更新文件,需要在管理员命令提示符下执行程序。
所以,程序都执行失败了。

为此,您想将文件的创建更改为用户目录,或者需要通过调用管理命令提示符来运行程序。