#include <stdio.h>
#include <stdlib.h>
... // 標頭檔
#define Result_TIMOUT 3
#define Result_INTIAL 0
#define Result_ERROR 1
... // 預處理
typedef enum
{
MD_INIT,
HARDWARE_CHECK,
FILESYSTEM,
BS_SEARCH,
BS_REGISTER,
BS_REG_CHK,
ME_FC_INIT,
ME_SOCKET,
ME_READY
}STATUS_MACHINE_INDEX;
... // struct, enum, union
extern md_Socket_CB SocketOpen_CB;
extern md_Socket_CB SocketClose_CB;
... // 外部變量等
使用條件編譯來防止頭文件被重複包含,以上述程式碼為例
#ifndef __MODEM_H__
#define __MODEM_H__
#include <stdio.h>
#include <stdlib.h>
... // 標頭檔
#define Result_TIMOUT 3
#define Result_INTIAL 0
#define Result_ERROR 1
... // 預處理
typedef enum
{
MD_INIT,
HARDWARE_CHECK,
FILESYSTEM,
BS_SEARCH,
BS_REGISTER,
BS_REG_CHK,
ME_FC_INIT,
ME_SOCKET,
ME_READY
}STATUS_MACHINE_INDEX;
... // struct, enum, union
extern md_Socket_CB SocketOpen_CB;
extern md_Socket_CB SocketClose_CB;
... // 外部變量等
#endif