问题描述
我正在尝试使用 strtol 将输入的字符转换为整数。这是源代码的一部分:
char option;
char *endptr;
printf("=========================================Login or Create Account=========================================\n\n");
while(1) {
printf("Welcome to the Bank management program! Would you like to 1. Create Account or 2. Login?\n>>> ");
fgets(&option,1,stdin);
cleanStdinBuffer();
option = strtol(&option,&endptr,10);
在 strtol 函数中,我收到一条警告:
Clang-Tidy: Narrowing conversion from 'long' to signed type 'char' is implementation-defined
谁能告诉我我做错了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)