我有一系列来自此类库文件头的#defines:
typedef int Lib_error;   
#define   LIB_ERROR_A      ((Lib_error) 0x0000) 
#define   LIB_ERROR_D      ((Lib_error) 0x0100)                   
#define   LIB_ERROR_F      ((Lib_error) 0x0200)                      
#define   LIB_ERROR_K      ((Lib_error) 0x0300)                
#define   LIB_ERROR_O      ((Lib_error) 0x0400)                
#define   LIB_ERROR_P      ((Lib_error) 0x0500)
#define   LIB_ERROR_R      ((Lib_error) 0x0600) 
#define   LIB_ERROR_X      ((Lib_error) 0x0700)             
#define   LIB_ERROR_Y      ((Lib_error) 0x0800) 
#define   LIB_ERROR_M      ((Lib_error) 0x0900) 
 /* and so on */
有什么办法可以分开我可以打印这些值,例如
uint MyError;
   /* printf("Error = %s",MyError); It should print the string LIB_ERROR_F instead of say 0x200 */
我可以为此使用很多 if else 但我想知道是否有更聪明的方法。请注意,无论如何我都无法更改库头文件的内容。