Read parameters from .dat file into C++? -


There are a lot of resources online about how to get input / output from text files in C ++, but I '

For example, I have a file that is a group of standards Reads like:

  NbProducts = 10; NB Plates = 3; NBiption = 6; MaxPosition = 3; Demand = [6907,14342,36857,40961,61129,69578,72905,91977,93969 97336];  

How do I drag it as a variable in the C ++ program? Thank you very much for helping in advance.

Here's a way to do this:

  • Open a file
  • Read the row
  • Divide that row on "="
  • Your parameter is the first result of the partition, and the price is the second result.
  • Repeat for each line.
  • You may need to strip the surrounding white location after splitting. You will need to parse the value after reading it, especially for your array.

    An alternative will store your data in something like JSON or XML and will use the current parser to read it.


    Comments

    Popular posts from this blog

    c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

    class - Kivy: how to instantiate a dynamic classes in python -

    python - mayavi mapping a discrete colorbar on a surface -