getip is defined in a file called test_support.cpp.
Here is that file:
Code:
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <fstream>
#include <fcntl.h>
#include <cstdlib>
#include "../../tek_1.03/library/tek_user.h"
#include "../include/test_support.h"
void getip(int device, char *ip)
{
FILE *inp = fopen("deviceInfo.txt","r");
char tmp[100];
char devicestr[10];
int eofdetect;
int stringCompare;
switch (device) {
case SCOPE:
strcpy(devicestr,"SCOPE");
break;
case AFG:
strcpy(devicestr,"AFG");
break;
default:
errhandle(20);
}
fscanf(inp,"%s",tmp);
if (strcmp(tmp,"instruments:") != 0)
errhandle(1);
eofdetect = fscanf(inp,"%s",tmp);
stringCompare = strcmp(tmp,devicestr);
while (stringCompare != 0 && eofdetect != EOF && strcmp(tmp,"END") != 0) {
eofdetect = fscanf(inp,"%s",tmp);
stringCompare = strcmp(tmp,devicestr);
}
if (stringCompare == 0) {
eofdetect = fscanf(inp,"%s",tmp);
if (eofdetect != EOF)
strcpy(ip,tmp);
}
else
errhandle(25);
fclose(inp);
}
int deviceCheck(char *device)
{
FILE *inp = fopen("deviceInfo.txt","r");
char tmp[100];
int eofdetect;
int stringCompare;
int usedevice = FALSE;
fscanf(inp,"%s",tmp);
if (strcmp(tmp,"instruments:") != 0)
errhandle(1);
eofdetect = fscanf(inp,"%s",tmp);
stringCompare = strcmp(tmp,device);
while (stringCompare != 0 && eofdetect != EOF && strcmp(tmp,"END") != 0) {
eofdetect = fscanf(inp,"%s",tmp);
stringCompare = strcmp(tmp,device);
}
if (stringCompare == 0)
usedevice = TRUE;
else if(strcmp(tmp,"END") == 0)
usedevice = FALSE;
else
errhandle(1);
fclose(inp);
return usedevice;
}
void errhandle (int mode)
{
switch (mode) {
// A lot of cases that Ive taken out to shorten this.
}