我试图char *在c中将a 转换为大写,但该函数toupper()在这里不起作用.
我正在尝试获取temp值的名称,这个名字在冒号之前是任何东西,在这种情况下它是"Test",然后我想完全将名称大写.
void func(char * temp) {
// where temp is a char * containing the string "Test:Case1"
char * name;
name = strtok(temp,":");
//convert it to uppercase
name = toupper(name); //error here
}
Run Code Online (Sandbox Code Playgroud)
我收到函数toupper期望int的错误,但收到一个char*.事实是,我必须使用char*,因为这是函数所采用的,(我不能在这里使用char数组,可以吗?).
任何帮助将不胜感激.