我在我的函数中收到这些编译警告,并且在我的代码中找不到任何错误:
警告:
src.c: In function ‘writeFiles’:
src.c:119:18: warning: character constant too long for its type [enabled by default]
src.c:119:2: warning: passing argument 1 of ‘fopen’ makes pointer from integer without a cast [enabled by default]
/usr/include/stdio.h:269:14: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
我的功能:
FILE *outfile;
int writeFiles(int pwm, int rpm)
{
outfile = fopen('/dev/fan/rpm', "w+"); /* line 119 with the warnings */ /*create the new file */
fprintf(outfile, "%d", rpm); /*write the rpm to the file */
fclose(outfile); /*close the file */
return ( 0 );
}
我希望你能帮助我解决这个问题。google 和 stackoverflow 都无法帮助找到解决此问题的方法。