1、switch語句: 編譯錯誤case label does not reduce to an integer constant
在case中肯定不能進行條件判斷.
用嵌套的if else 就解決了
switch語句的格式為
switch(表達式)
{
case 常量表達式1: 語句1
case 常量表達式2: 語句2
^^^^^
case 常量表達式n: 語句n
default: 語句n+1
}
2、atoi: warning: passing arg 1 of `atoi' makes pointer from integer without a cast
3、`O_CREAT' undeclared (first use in this function)
man open 然后加上頭文件解決
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
4、warning: implicit declaration of function `close'
man close
#include <unistd.h>
5、 可能和sprintf有關
#include<stdio.h>
#include<string.h>
6、comparison is always true due to limited range of data type
警告原因:有可能你定義了unsigned int uParam;但是你去做了if(uparam<0)的判斷,
因為unsigned int 型的數據總是>=0的,因此這樣的比較由於數據類型限制了它的范圍,因此也就給出了警告。
解決方法:可以去掉這樣的判斷。