Re: I know that global variables are evil but ...
Thank you for the replies.
I need to do a lot more reading about "Singletons".
I understand from the above that reading a configuration file every time I need the serial port is not a problem but that the code I use to do it should be in one class which I call whenever I need a variable from the configuration file. As a suggestion:
Port = getConfVariable("port", "hardware")
I could use the getConfVariable whenever I needed anything from my configuration file.
The question remains where to define the name of my configuration file? Here I can either hardcode it in to my getConfVariable class or I could use a global variable so that I can have it right at the top of my code where it is easy to find and easy to change if ever I want to change from ~/.gabow,conf
I appreciate all your helps and comments
Thanks!
I am a newbie. I have been for many years now. Sometimes I feel that I understand things, turn the corner and find that there is even more to understand.
Bookmarks