typedef struct { int nMaxC; // Maximum number of command data bytes int nMaxR; // Maximum number of dat bytes that can be requested in a response int CType; // The card types supported by the ACR10 BYTE CStat; // The status of the card reader BYTE CSel; // The current selection of card type BYTE szRev[10]; // The 10 bytes ACR10 firmware type and revision code int nLibVer; // Library version (e.g. 310 is equal to version 3.10) long lBaudRate; // Current Running Baud Rate } AC_INFO;Assuming that each int takes 2 bytes, each BYTE takes 1 byte, and the long takes 4 bytes; the length of the string buffer is (2 + 2 + 2 + 1 + 1 + 10 + 2 + 4) = 24 bytes
* allocating a string buffer of 24 bytes cBuffer = REPLICATE(CHR(0), 24) * declaring the function * DLLAPI int AC_decl AC_GetInfo(int, AC_INFO *); DECLARE SHORT AC_GetInfo IN mcr930 SHORT, STRING@ * calling the function nResult = AC_GetInfo(hReader, @cBuffer)If the call is successful, we assume that the cBuffer is populated with values. The cBuffer is still a string. To get the numeric values from it use CTOBIN() or similar functions.
nMaxR = ASC(SUBSTR(cBuffer,3,1)) +; ASC(SUBSTR(cBuffer,4,1)) * 256You can find multiple code samples dealing with structures in VFP on my web site. For example,