Hello All,

how can I create a member function for a class that is reading from a txt file, which is reading computer network addresses and names for the addresses.

I was guessing they need to be string and 4 ints data type.

Example of data.txt file input
111.22.3.3 "green
111.22.44.4 " purple"

also with the option to read 100 addresses

Recommended Answers

All 2 Replies

>>I was guessing they need to be string and 4 ints data type.

That would be a description of the member variables needed for a class such as you describe.

Hello All,

how can I create a member function for a class that is reading from a txt file, which is reading computer network addresses and names for the addresses.

I was guessing they need to be string and 4 ints data type.

Example of data.txt file input
111.22.3.3 "green
111.22.44.4 " purple"

also with the option to read 100 addresses

u better use two strings: 1 for the IP , 1 for the name. Thats enough. It will consume less memory as by int and will be easy for further use in methods like socket(), connect() etc wherever required.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.