我有这个函数可以从网络中执行一些免费和取消操作:
void UNREG_on_exit(COT_arguments args, Node_Information *node)
Run Code Online (Sandbox Code Playgroud)
我试图让它在退出程序时被调用(即使使用 Ctrl+C)
问题是我如何传递参数?从未做过函数指针,也无法真正找到答案。
目前我有:
void UNREG_on_exit(args, &node); // This is how you make the pointer?
atexit(UNREG_on_exit);
// or //
atexit((void) {
    UNREG_on_exit(args, &node); // Or like this?
});
Run Code Online (Sandbox Code Playgroud)
我不知道,他们都给我一个错误。
“需要一个标识符”,参数下有一条红线
附加信息:
typedef struct Node_Information
{
    int id;
    int net;
    Backup bck;
    Extern ext;
    Intern *intern_list;
    int InNetword;
    int debug_mode;
    int IsREGED;
    int fd;
    Table *table_list;
    StringList *contents_list;
    PendingConnections *pending_connections_list;
    QueryList *query_list;
} Node_Information;
typedef struct COT_arguments
{
    char *IP;
    int TCP;
    char *reg_IP;
    int …Run Code Online (Sandbox Code Playgroud)