Here's an example of validating a tape
#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_ERROR:
{
printf("Tape error: %.2d:%.2d:%.2d.%3d\n",
(int) pNxCoreSys->nxTime.Hour,
(int) pNxCoreSys->nxTime.Minute,
(int) pNxCoreSys->nxTime.Second,
(int) pNxCoreSys->nxTime.Millisecond);
return NxCALLBACKRETURN_STOP;
}
// WAITFORCOREACCESS is not necessarally an error.
// It is generated when:
//
// 1) You are running from the current days tape
// (IE not from a tape file) and signifies NxCoreAccess
// program is not running or is in a transitional state
// from one day to the next. In this case it is safe to continue.
//
// 2) The tape file is incomplete. In this case the application
// should stop.
//
// For this example we will let the program continue.
//
case NxCORESTATUS_WAITFORCOREACCESS:
{
printf("Wait For Access: %.2d:%.2d:%.2d.%3d\n",
(int) pNxCoreSys->nxTime.Hour,
(int) pNxCoreSys->nxTime.Minute,
(int) pNxCoreSys->nxTime.Second,
(int) pNxCoreSys->nxTime.Millisecond);
}
}
break;
}
}
return NxCALLBACKRETURN_CONTINUE;
}
int main(int argc, char** argv)
{
if (argc == 1)
{
fprintf(stderr, "Usage: %s Tape\n", argv[0]);
return -1;
}
if (!nxCoreClass.LoadNxCore("NxCoreAPI.dll") &&
!nxCoreClass.LoadNxCore("C:\\Program Files\\Nanex\\NxCoreAPI\\NxCoreAPI.dll"))
{
fprintf(stderr, "Can't find NxCoreAPI.dll\n");
return -1;
}
int rc = nxCoreClass.ProcessTape(argv[1], 0, 0, 0, nxCoreCallback);
if (rc)
{
printf("%s is not valid: %d\n", argv[1], rc);
}
else
{
printf("%s is valid\n", argv[1]);
}
return 0;
}