Currently, I have 2 variables (ROWS and COLS) hardcoded in my C/C++ program. These two variables are:
const int COLS = 125;
const int ROWS = 100;
Instead of hardcoding them, I'd like to dynamically read them from an input file instead. So, the pseudo process should be:
1. const int COLS = 0;
2. const int ROWS = 0;
3. Open "data_input_file.hdr" (see attached)
4. Read first two lines of the header files
5. Now set the following: const int COLS= 125; // where header file's ncols = COLS
6. and set const int ROWS = 100; // where header file's nrows = ROWS
7. Close "data_input_file.hdr" ... or something like this
Note: For file uploading purposes into EE, I had to change the extension from ".hdr" to ".txt".
How do I do this? Pls provide specific C/C++ code?