I'm working on a program written in VC++ 6.0 and I'm at a point where I want to increase the efficiency of the program. It's a conversion utility that parses an ASCII file for conversion factors and links them to an ASCII/and/binary data file (names in ASCII in a file header, data values to be converted in binary after the header) using a third file that matches the names in the other two files. Right now the program reads in the ASCII data as strings and runs strcmp() comparisons to make matches. Then a separate function accepts each individual data value and converts it using the conversion factors and returns the value to be written as a bit-packed data word to an output file.

I don't know how to explain it any better than that, so sorry if it's a little confusing.

The data is stored in an array with rows representing scans (based on time). Each scan starts with a flag indicating which data is present (matched to the ASCII names in the header of the file).

I'm curious about two things:

First, would it save time to, instead of calling the function for each data value, instead send an entire scan to the function and convert that? Also, is this even plausible since each data value requires a different conversion factor?

Second, is there a way of reading in ASCII data in binary and running "string comparisons" on it, instead of having to read it in as ASCII and doing the time consumptive strcmp()?

I'm not very familiar with working with binary, so I may be reaching in the dark here. If anyone has any suggestions I'd appreciate the help.

If it's of use, the data file contains about 50 to maybe 200 ASCII names and maybe 10000 to 20000 scans avg. The current code throws the ASCII names into vectors or arrays and iterates through it for comparison. The whole conversion process takes anywhere from 20s to 5mins, depending on the size of the files.

example of files (probably not much use, but might clarify some things)

binary file below (header- strings, body- flag [1-on or 0-off], data value of flags that are on):
data1 data2 data3
001 3
010 2
111 1 2 3

ascii file below (contains name, identifying octal label, conversion factor):
dat1 127 100
dat2 128 75
dat3 129 165

(a third file matches the names up to link the conversion factors to the data to be converted)
127 data1 dat1
128 data2 dat2
129 data3 dat3