officialandrey
@officialandrey

В чем ошибка при попытке чтения из потока в СИ?

Список ошибок:
1>d:\secret\secret\secret.c(12): error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>c:\program files (x86)\windows kits\10\include\10.0.16299.0\ucrt\stdio.h(207): note: см. объявление "fopen"


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

int main() {
	
	setlocale(LC_ALL, "Russian");

	int N = 10, start = 2, i, val, j;
	FILE *F;

	if ((F = fopen("output.txt", "a")) == NULL) {
		printf("File 'output.txt' - not found.\n");
	}

	for (i = 0; i < N; i++) {
		val = start;

		printf("VALUE: %d\n", val);
		fprintf(F, "VALUE: %d\n", val);

		for (j = 0; val != 1; j++) {
			if (val % 2 == 0) {
				printf("\tЧ: %d/2", val);
				fprintf(F, "\tЧ: %d/2", val);
				val = val / 2;
				printf("=%d\n", val);
				fprintf(F, "=%d\n", val);
			}
			else {
				printf("\tН: %d*3+1", val);
				fprintf(F, "\tН: %d*3+1", val);
				val = val * 3 + 1;
				printf("=%d\n", val);
				fprintf(F, "=%d\n", val);
			}
		}
		fclose(F);
		start++;
	}

	return 0;
}
  • Вопрос задан
  • 118 просмотров
Решения вопроса 1
@jimquery
Попробуйте перевести на русский язык текст из ошибки:
This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы