I'm looking to be able to import variables from an outside source. If i were to create a file that said:
var1 = 15
var2=C:/Files/run.exe
How would i accomplish this? What would be the best alternative if this is not possible.
I'm looking to be able to import variables from an outside source. If i were to create a file that said:
var1 = 15
var2=C:/Files/run.exe
How would i accomplish this? What would be the best alternative if this is not possible.
1. Open the file in question.
2. Read a line from the file as a string
3. Parse that string into an identifier ("var1") and a value ("15")
4. Store the identifier and value using some method (std::map will do nicely)
5. If you're not at the end of the file, go to 2
6. Do something useful with the information you read
7. ...
8. Profit!
Maybe somebody should notify the International Organization of Standards that their C99 C standard is out-dated.
If you're using C++ they're out of date unless you have a specific need for them (usually to support other legacy code).
Bookmarks