Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5339

reading from file into array of structures

$
0
0

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


Viewing all articles
Browse latest Browse all 5339

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>