01-13-2019 11:58 PM
I would like to read from file into array of structures. The file can be organized as one structure per line:
3000,3200,3,17,1,1,3
3201,3400,3,18,5,2,1
...
My intent is to initialize some integer constants depending on a frequency band given by first two elements in structure as follows:
I'm not sure how to initialize the structure from the file.
typedef struct {
double lowFreq;
double highFreq;
int doubler;
int PreN;
int mult;
int N;
int cpGain;
} Band[numBands];
for (i = 0; i = numBands; i++) {
if ((inFreq >= band[i].lowFreq) & (inFreq <= band[i].highFreq))
{
doubler = band.doubler;
PreN = band.PreN;
mult = band.mult;
N = band.N;
cpGain = band.cpGain;
}
}
Thanks
Solved! Go to Solution.
01-14-2019 01:48 AM
Given the file structure you have reported, I see no way of reading it other that using either standard C functions (fopen, fgets, fclose) or their equivalents in the CVI Formatting and I/O Library (OpenFile, ReadLine, CloseFile). The help file for the functions include links to some example programs that may help you to design your own code.
01-14-2019 08:11 PM
That's what I'll do.
Thanks.