如何在c函数中访问变量参数

时间:2012-02-04 20:18:23

标签: c function variadic-functions

我有以下c代码:

    int connect (){
    const char * portname = "\\\\.\\COM4"; 
    int returnVal = -1;

    // get the connection ID
    connectionID = FoxNewConnectionId();
    fprintf(stderr, "Connecting to %s ...\n", portname);

    // attempt to connect
    returnVal = FoxConnect(connectionID, portname, TG_BAUD_9600, STREAM_PACKETS);
    // check whether the connection attempt was successful 
    if(!returnVal){
        fprintf(stderr, "connected. %d\n", returnVal);

    }
}

FoxNewConnectionId()FoxConnect()是外部库的函数指针。 如何在不再访问connectionID的情况下获取connect()的值。

我尝试返回connectionID,但我不知道如何在不再访问整个connectionID的情况下获取connect()的值。

0 个答案:

没有答案