inifile.h
来自「linux下的一个分组遗传算法」· C头文件 代码 · 共 54 行
H
54 行
//// inifile.h - A general inifile class//// author: J.I.v.Hemert// last updated : 08-10-1997//// This file contains the class IniFileC, which can be used to read in// values (strings, doubles and integers) from an external inifile. It// still has some constraints. Labels cannot be longer than 300 characters// and the number of labels cannot exceed 50. The inifile should consist of// lines like this : "value = 0". The spaces around the equalsign must be// there. Empty lines are ignored, just as lines starting with an #.//#ifndef INIFILE_H#define INIFILE_H#include <string.h>#include <fstream.h>#include <stdlib.h>#include <malloc.h>#define MAXLABELS 50#define MAXSTRINGLENGTH 300typedef char StringT[MAXSTRINGLENGTH];class IniFileC{ public: void Open (StringT filename); // Open file and read in labels char * ReadString (StringT label); // Return string with label double ReadDouble (StringT label); // Return double with label int ReadInt (StringT label); // Return integer with label bool ReadBool (StringT label); // Return boolean with label private: int nroflabels; StringT labels[MAXLABELS]; StringT data[MAXLABELS]; StringT name; ifstream filedata;};#endif// eof inifile.h
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?