02-16-2023 12:47 PM
I have several normalized text files with data points (1024 rows, each row have one double value). I would like to "include" these files into my application such that during usage, the values from the files are read into arrays using FileToArray.
Is there a way of including the files into the binary executable/distribution? I know that I can include the *.txt files in the distro, but then they can be damaged by user.
The alternative I can think of is just to format the file into a double array declared in the program. That then takes up a huge amount of whitespace in a source file.
02-18-2023 04:40 AM - edited 02-18-2023 04:42 AM
If you save your files in binary format you should be able to distribute them without being afraid they can be edited by anyone (I suppose you want to discourage accidental editing, not to prevent an intentional crack of your code).
02-27-2023 07:54 AM - edited 02-27-2023 07:55 AM
What I ended up doing was simply formatting it into a separate header file:
#define SAMPLE_DATA_KEV (const double[X123_RESOLUTION]) \
{ \
-0.200258989, \
-0.131022924, \
-0.061786859, \
0.007449206, \
0.076685271, \
0.145921336, \
0.215157401, \
0.284393466, \
...
0, \
0, \
0, \
0, \
}, \
}0.284393466, \
Notepad++ to the rescue for formatting.
02-27-2023 12:42 PM
I was under the impression that you did not like this solution. What have made you change your opinion?
02-27-2023 12:52 PM
I guess I didn't like the idea of having "dangling files" in the distro that could be damaged, and if so could be hard to repair, find, etc. By by being in the source code, I can manage completely.
Also, by having in a separate header file, the "messiness" of it is at least relegated to a dedicated file.
Hypothetically, it would be a fascinating feature of a graph control if you could "load" sample data into a plot on the control. This would basically cover what I'm trying to do and would result in no latency when used in my UI. It would behave like the DEFAULT_VALUE property of many other controls. Hmmm.