刷算法题时发现VS2015疑似无法输出数据,就搬出了之前在另一台电脑同样使用VS2015编写的一个输出工具
结果仍然无法输出
运行环境:vs 2015 community(默认设置),win10家庭版
文件不处于调用状态也不为只读属性
#include "stdafx.h"
#include "ctype.h"
#include "stdlib.h"
#include "string.h"
int main()
{
FILE *fp;
fopen_s(&fp, "output2.txt", "w");
char s[40];
int c, i;
memset(s, ' ', sizeof(s));
while (scanf_s("%s", s, 40) == 1) {
scanf_s("%d", &c);
for (i = 1; i <= c; i++)
{
printf("%s\n", s);
int d=fprintf(fp, "%s\n", s);//输入字符串 空格 整数,重复输出n次到文件中
}
}
fclose(fp);
return 0;
}