c - 函数'fopen_s'的隐式声明[-Wimplicit-function-declaration] FILE *f = fopen_s(stdin);
问题描述
嗨,我的编译器出现以下错误,请帮忙!
从编译器:main.c:在函数'main'中:main.c:25:13:警告:函数的隐式声明
fopen_s' [-Wimplicit-function-declaration] 文件 *f = fopen_s(stdin); ^~~~~~~
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
//FILE *f ;
int main(int argc, char **argv) {
int charCount = 0;
int wordCount = 0;
int lineCount = 0;
int doChar = 0;
int doWord = 0;
int doLine = 0;
int inWord = 0;
int c = 0;
char *fileName = 0;
FILE *f = fopen_s(stdin);
// prompt user to enter filename
printf("Please enter a filename: \n");
// fgetwc(f);
//loop
while (argv++, -- argc) {
if (!strcmp(*argv, "-c")) doChar = 1;
else if (!strcmp(*argv, "-w")) doWord = 1;
else if ( !strcmp(*argv, "-l")) doLine = 1;
else if (!( f = fopen((fileName = *argv),"r"))) {
printf("Usage: wc [-1] [-w] [-c]\n");
return 1;
}
}
if (!(doChar || doWord || doLine)) {
doChar = doWord = doLine= 1;
}
while(EOF !=( c= fgetc(f)))
{
charCount++;
}
if (c == '\n') {
lineCount++;
}
if (!isspace(c)) {
if (!inWord){
{inWord = 1; wordCount++;}
}
else {
inWord = 0;
}
}
if (doLine){
printf("%8d\n",lineCount);
}
if (doWord){
printf("%8d\n", wordCount);
}
if(doChar){
printf("%8d\n",charCount );
}
if (fileName) {
printf(" %s\n",fileName);
}
printf("\n" );
}
解决方案
推荐阅读
- go - 使用 Gorm 在单独的表中将值从一列映射到另一列
- cmake - CMake - 如何在打包期间阻止执行安装脚本?
- c# - 变换.位置传送。移动不顺畅
- robotframework - 与 SikuliX 一起使用时,屏幕截图未嵌入到 RobotFramework 日志文件中
- java - 升级到 Spring 框架 2 后,RestTemplate 交换得到错误响应
- php - 在php上运行exec命令
- python - 如何在python中使用JsonPath更改json文件中的值
- python - Python - 使多个变量有一个新的结果
- javascript - AutoML 自然语言 Node.js API 调用给出“bad base64 decode”错误
- c# - 在 EmguCV.3.1.0.1 中找到图像的傅里叶变换的最少代码是什么?