我有以下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()
的值。