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 );
#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 |
Here's an example of finding and printing all NxCore tapes on this machine
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include "NxCoreAPI.h" #include "NxCoreAPI_Wrapper_C++.h" NxCoreClass NxCore; 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 NxCALLBACKRETURN_CONTINUE; } void dumpTapes() { MyTapeList tapeList; tapeList.count = 0; NxCore.ListTapes(NxLTF_SEARCH_LOCAL, listTape, &tapeList); for (unsigned int i = 0; i < tapeList.count; i++) printf("%s\n", tapeList.tapeFiles[i].PathnameStrZ); } int main(int argc, char** argv) { if (!NxCore.LoadNxCore("NxCoreAPI64.dll") && !NxCore.LoadNxCore("NxCoreAPI.dll")) { printf("loading library failed\n"); return -1; } dumpTapes(); return 0; } |
import net.nanex.NxCoreClass; class ListTapesSample extends NxCoreClass{ MyTapeList tapeList = new MyTapeList(); class MyTapeList { int numTapes = 512; NxCoreTapeFile tapeFiles[] = new NxCoreTapeFile[numTapes]; int count = 0; }; //callback function must be called OnUserListTapes for Java @Override public int OnUserListTapes(NxCoreTapeFile nxTF) { if (tapeList.count < tapeList.numTapes) tapeList.tapeFiles[tapeList.count++] = nxTF; return defines.NxCALLBACKRETURN_CONTINUE; } void dumpTapes() { //Only argument is ControlFlags for Java ListTapes(defines.NxLTF_SEARCH_LOCAL); for (int i = 0; i < tapeList.count; i++) System.out.println(tapeList.tapeFiles[i].PathnameStrZ); } public static void main(String args[]) { ListTapesSample nxCore = new ListTapesSample(); if (nxCore.LoadNxCore("NxCoreAPI64.dll") != 0){ nxCore.dumpTapes(); } else System.out.println("loading library failed"); } } |
import NxCore tapeFiles = [] def OnUserListTapes(nxTF): global tapeFiles tapeFiles.append(nxTF) return NxCore.NxCALLBACKRETURN_CONTINUE def dumpTapes(): NxCore.ListTapes(NxCore.NxLTF_SEARCH_LOCAL, OnUserListTapes); for i in range(len(tapeFiles)): print(tapeFiles[i].PathnameStrZ); if NxCore.LoadNxCore("NxCoreAPI64.dll"): dumpTapes() else: print("loading library failed") |