Table of Contents


ListTapes

Lists all available tapes on this computer


    #define cszNxCoreListTapes "sNxCoreListTapes"
    typedef int (__stdcall *NxCoreListTapes) (unsigned int controlFlags, NxCoreCallbackTapeList stdcallback, void* pYourParam);

    int ListTapes(
        unsigned int                    controlFlags,
        NxCoreCallbackTapeList          stdcallbacklist,
        void*                           pYourParam
        );

controlFlags

#define Value Comments
NxLTF_SEARCH_LOCAL 0 Only search local drives for NxCore tapes
NxLTF_SEARCH_NETWORK 1 Search local and network drives for NxCore tapes
NxLTF_SEARCH_REMOVEABLE 2 Search local and removable drives for NxCore tapes

Example

Here's an example of finding and printing all NxCore tapes on this machine


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

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

NxCoreClass nxCoreClass;

struct MyTapeList
{
    static const int numTapes = 512;
    NxCoreTapeFile   tapeFiles[numTapes];
    unsigned int     count;
};

int __stdcall listTape(void* pUserParam, const NxCoreTapeFile* pNxTF)
{
    MyTapeList* tapeList = (MyTapeList*) pUserParam;

    if (tapeList->count < tapeList->numTapes)
    {
        memcpy(&tapeList->tapeFiles[tapeList->count++], pNxTF, sizeof(*pNxTF));
    }

    return  0;
}

void dumpTapes()
{
    MyTapeList tapeList;
    tapeList.count = 0;

    nxCoreClass.ListTapes(NxLTF_SEARCH_LOCAL, listTape, (void*) &tapeList);

    for (unsigned int i = 0; i < tapeList.count; i++)
    {
        printf("%s\n", tapeList.tapeFiles[i].PathnameStrZ);
    }
}

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;
    }

    dumpTapes();

    return 0;
}