我在Visual Studio 2015中为C ++做了一项任务,在尝试打开文件读取值时,我一直收到stream != nulltpr
错误或stream.valid()
错误。我的代码有问题吗?
#include "stdafx.h"
FILE *data;
int main(void)
{
errno_t err;
err = fopen_s(&data, "input.txt", "r");
if (err == 0) {
printf_s("the file was opened");
}
else {
printf_s("error, input file not opened\n");
}
return 0;
}