next up previous contents index
Next: Dynamic linker Up: Module SysTools Previous: Using DVList   Contents   Index


Using DataCards

The DataCards class can be used to read parameters from a file. Each line in the file starting with defines a set of values associated with a keyword. In the example below, we read the parameters corresponding with the keyword SIZE from the file ex.d. We suppose that ex.d contains the line:
@SIZE 400 250

#include "datacards.h"
// ...
// Initialising DataCards object dc from file ex.d
DataCards dc( "ex.d" );
// Getting the first and second parameters for keyword size
// We define a default value 100
int size_x = dc.IParam("SIZE", 0, 100);
int size_y = dc.IParam("SIZE", 1, 100);
cout << " size_x= " << size_x << " size_y= " << size_y << endl;



Reza Ansari
2001-03-07