开发者

Reading files multi-data-type (c++)

开发者 https://www.devze.com 2022-12-15 09:45 出处:网络
I want to read from one file that has several kinds of data-types. I utilize ifstream (C++ language) but it can\'t read strings.

I want to read from one file that has several kinds of data-types. I utilize ifstream (C++ language) but it can't read strings.

In fact, I have written a code that has too many options and input parameters. Now, I want to read these parameters开发者_如何学运维 and (bool) options from an input file, then I can run my program by edition of input file and running makefile. I think I want something like this:

...

Number of Groups = 3

Name of Groups = David Jack Jill

...

Now, my code must allocate memory for "Groups" object. Group should have 3 member that their names are David, Jack and Jill.

Can anyone help me, please?

Thanks


std::ifstream can certainly read strings. Have you remembered to include <string> though?

0

精彩评论

暂无评论...
验证码 换一张
取 消