API Documentation

GetDefinedString

Converts a string index into an pre-defined null-terminated ASCII string.

NOTE: These strings are a part of the tape, not the dll, so on older tapes you may have less indexes available than on newer tapes, but the resulting values will be the same.

NOTE: Defined strings are loaded after NxCORESTATUS_INITIALIZING status callback.


    #define cszNxCoreGetDefinedString "sNxCoreGetDefinedString"
    typedef const char* (__stdcall *NxCoreGetDefinedString) (int ixTable, int ixString);

    const char* GetDefinedString(
        int                             ixTable,
        int                             ixString
        );

Parameters

ixTable

One of values as defined in reference_Tables.html

ixString

A zero-based number that indexes into one of the String Tables indexed by ixTable.

Example

Here's an example of printing the first exchange as soon as we're sure that the string tables are loaded


#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <stdio.h>

#include <NxCoreAPI.h>
#include <NxCoreAPI_class.h>

NxCoreClass nxCoreClass;

int __stdcall nxCoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage)
{
    switch (pNxCoreMessage->MessageType)
    {
        case NxMSG_STATUS:
        {
            switch (pNxCoreSys->Status)
            {
                case NxCORESTATUS_RUNNING:
                {
                    static bool needToPrint = true;
                    if (needToPrint && pNxCoreSys->nxTime.MsOfDay > 0)
                    {
                        needToPrint = false;
                        printf("%s\n", nxCoreClass.GetDefinedString(NxST_EXCHANGE, 1));
                    }

                    break;
                }
            }
        }
    }

    return NxCALLBACKRETURN_CONTINUE;
}

int main(int argc, char** argv)
{
    if (!nxCoreClass.LoadNxCore("NxCoreAPI.dll") &&
        !nxCoreClass.LoadNxCore("C:\\Program Files\\Nanex\\NxCoreAPI\\NxCoreAPI.dll"))
    {
        fprintf(stderr, "Can't find NxCoreAPI.dll\n");
        return -1;
    }

    nxCoreClass.ProcessTape(argv[1], 0, NxCF_EXCLUDE_CRC_CHECK, 0, nxCoreCallback);

    return 0;
}