(void)WriteDev("syst:pres");
(void)viClose(Instr);
(void)viClose(defaultRM);
_exit(0);
}
// command line arguments
struct CmdArgs
{
bool bUSB; // GPIB if false
unsigned int nAddr; // GPIB address. Not used for USB
double Pacing;
char Func[64]; // measurement function
bool bPeriod; // is Meas Func one of Period functions
// or one of Freq functions
double RefVal, Delta;// reference value and acceptable error
// (used to check meas results)
double RefFreq; // reference freq
};
// check if string is one of the given set. returns
// the number of matched string or -1 if no matches are found
inline int CheckStr(char const *s, int nSLen, char const *Set[],
int nSetSize)
{
for(inti=0;i<nSetSize; i++ )
if(0==strncmp(s, Set[i], nSLen) && nSLen ==
strlen(Set[i]) )
return i;
return -1;
}
// Parse command line. Format:
// <Executable> USB|GPIB[:<Address>] [<Pacing>] [<Meas Func>]
// [<RefFreq>] [<Delta>]
bool ParseCmdArgs(CmdArgs *pArgs, int argc, char* argv[])
{
static char const *StrInterfaces[] = { "USB", "GPIB" };
static char const *StrMeasFuncs[] =
{
"PER",
"PER:BTB",
"FREQ:BTB"// <-nFirstFreq
};
static int const nFirstFreq = 2;
Programming Examples
Error Code 4-15