Hello,I need to read a file containing 161 commands and store it in a vector of strings using vector_pushback and then print the 161 commands.Which is the best way to proceed with this ?
sarathsshanker
0
Newbie Poster
Recommended Answers
Jump to Postuset getline to get you file a line at a time as a string and then vector::push_back to add it to the vector. The will be a little inefficiency as the vector reallocates memory as it grows but for 161 entries this is unlikely to be a big issue.
All 2 Replies
Reply to this topic
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.